Advertisement

07.17.2008 at 10:24PM PDT, ID: 23575855
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Vertical gap between two floated elements

Asked by tolvor in Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)

I have two elements, one a title bar, and one a graphic.  The title bar contains a floated element (h1), and the graphic itself is floated left.  However between the two is a mystery gap. The gap has something to do with the floats because if they are removed, the gap disappears, however I do need the floats.  I've tried various clearing methods after the titlebar div, and setting the font to 0, and the various margins to 0, but the gap remains.

The code passes w3c html and css validation checks.  It displays *correctly* in IE6, but *not* in FF3.0.

I'd appreciate if you could show how to get the two elements to be adjacent and without the gap.

This has been stumping me and have researched this and still can't find what's happening.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>SiteTitle</title>
<style type="text/css">
 
p, h1, h2 {margin-top: 0; padding: 0;}
 
html, body {margin:0; padding:0; left:0; margin-top:0;padding-top:0; font-size: 0;}
 
body {
  font: 100% Arial, Helvetica, sans-serif;
  font-size: small;
  margin: 0; 
  padding: 0;
  text-align: center; 
}
 
/* ===================Right Header Container=========================  */
 
 
#header_righttopbar {
  background-color: #000;
  height: 30px;
}
 
.header_title {
  float: left;   /* this must be floated */
  margin-top: 0px;
  padding-top: 0px;
  width: 55%;
}
 
#header_righttopbar h1 {
  text-align: left;
  color: #0f0;
}
 
#contentcolumn{   
  float: left;      
  color: #000;
  border-top: 0px;
  font-size: small;
}
 
#rightcolumn{         
  font-size: 0px;
  border-top: 0px;
  padding-top: 0px;
  margin-top: 0px;
  float: left;         /* if this is removed, gap will disappear - this must be 
 
floated  */ 
  width: 510px; 
  height: 339px;
  background-image: url("headerpic.jpg");
  background-repeat: no-repeat;
}
 
/* I've tried scattering this around, doesn't help */
.clearfloat { /* this class should be placed on a div or break element and should 
 
be the final element before the close of a container that should fully contain a 
 
float */
  clear:both;
  height:0;
  font-size: 1px;
  line-height: 0px;
}
 
</style>
 
</head>
 
<body>
  <div id="header_righttopbar">
    <h1 class="header_title">Title</h1>
  </div>
 
  <div id="rightcolumn">
    <p>testing 1 2 3</p>
  </div>
 
</body>
</html>
Attachments:
 
headerpic
headerpic
 
[+][-]07.17.2008 at 10:54PM PDT, ID: 22033142

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)
Sign Up Now!
Solution Provided By: jman56
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628