Forum Moderators: not2easy
Problem occurs in Firefox, IE(7) and Safari (for PC).
Simplified code from a two column layout.
<div id="container">
<div id="navholder"> NAVIGATION </div>
<div id="main"> CONTENT, then...
<div id="1"> LEFT BOX ON ONE LINE </div>
<div id="2"> MIDDLE BOX ON ONE LINE </div>
<div id="3"> RIGHT BOX ON ONE LINE </div>
</div>
</div>
<div id="bottom"> BOTTOM 'BANNER' </div>
CSS (again, simplified) :
#container { text-align: left; width:990px; margin: 0 auto;
}
#navholder { float: left; width: 200px; margin-left:10px;
}
#main { float: right; text-align:left; margin-right:4px; width:768px;
}
#1,2,3 { width:250px; float:left; margin-right:5px;
}
#bottom { background-image:url(); background-repeat:repeat; clear:both;
}
I isolated a problem caused by the third div (3) as follows -
(a) I get a horizontal scrollbar at the bottom of my screen, and
(b) the background image in #bottom doesn't stretch to fit.
I've managed to fix this by killing the bottom scrollbar with 'overflow-x: hidden;' in the body CSS style. This does mean that the few people still using 800x600 won't be able to scroll to see the content.
I tried putting the #1,#2,#3 in their own containing div but that didn't help.
Any idea why a third div within the #main area woudl cause this?
Even if it were, your selector
#1,2,3should be
#1, #2, #3
The far easier solution is to get rid of those individual ids, (there's really no need)
<div id="main"> CONTENT, then...
<div> LEFT BOX ON ONE LINE </div>
<div> MIDDLE BOX ON ONE LINE </div>
<div> RIGHT BOX ON ONE LINE </div>
</div>
#main>div {
width:250px;
float:left;
margin-right:5px;
}
IE6 won't do the direct child selector, if you have no other divs inside those divs, you can use "#main div" instead, or teach it support for the selector by adding IE7.js
.clear {
clear: both;
}
numeric id isn't fully legal.
I do have other divs inside the #main div on other pages.
I've also already tried the <br class="clear"> fix and that didn't sort it.
From the way it displays, it seems to me that the browser is thinking that it only needs to show the #bottom div 990px wide and this is because of the third div floated in the #main area.
There is clearly something in my code that's wrong because all 3 browsers are rendering exactly the same.
I'll read up on clearfix. If I draw a blank after that may I PM you a link to the page in question?