I am having trouble diagnosing what is causing a gap in a section of my page. I searched SO and Google, however I could not pinpoint any helpful articles. I have a container which contains a title, an unordered list and a div with information. The problem is a gap is occurring between the div and the ul. I would like the div to be directly under the ul with no spaces. An example can be seen here: http://jsfiddle.net/aAfU5/1/ (Remember IE7)
HTML
<div id="center-panel">
<h1>Information</h1>
<ul class="clearfix">
<li class="bg1 border2">Regulation</li>
<li class="bg1 border2">Compliance</li>
<li class="bg1 border2">Resources</li>
</ul>
<div id="information-panel" class="border2">
This is where the content goes
</div>
</div>
CSS:
#center-panel {
height: 300px;
float: left;
width: 78%;
padding: 5px;
}
#center-panel ul {
padding: 0px;
margin: 0px;
}
#center-panel li {
color: white;
/*display:inline-block;*/
/*display:inline;*/
float: left;
font-weight: bold;
list-style-type: none;
margin: 0px 2px;
padding: 3px;
width: 100px;
}
#information-panel {
clear: both;
margin: 0px 2px;
}
h1 {
margin: 0 0 10px 0;
padding: 0;
font-size: 120%;
color: #01305E;
}
.bg1 {
background: #3C698E;
}
.border2 {
border: 1px solid #01305E;
}
It’s your H1 margin that “spills” under the ul.
Replace it with a padding :
You could also add zoom to trigger haslayout