Forum Moderators: not2easy
The two content columns are inside of #maintext. Because they are floated, #maintext essentially collapses. Adding a height: 100% to #maintext fixed the problem in IE, but not for Mozilla.
I found this thread, which directly addresses my problem:
[webmasterworld.com...]
Here's the code so you can see what I'm working with. Obviously, you can't see the background images, but if you check the code in Mozilla and IE, you can see how #maintext has a red dotted border. It collapses in Mozilla, but wraps the div in IE.
Thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>New site</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css" media="all">/* general stuff */
img{
display: block;
border: 0;
}
/* layout */
body {
background: #333;
color: #333;
margin: 0;
padding: 0;
border: 0;
text-align: center;
font-family: verdana;
font-size: 11px;
padding-bottom: 20px;
}
#wrap {
color: #333;
margin: 10px auto;
padding: 0;
border: 0;
width: 700px;
}
#header {
width:700px;
border:0;
color:#000;
height:170px;
position:relative;
text-align: left;
background-image: url("images/header2.png");
background-repeat: no-repeat;
background-position: top center;
}
#maintext {
background-image: url("images/body2.png");
background-repeat: repeat-y;
background-position: center;
height:100%;
border: 2px #f00 dotted;
}
#leftcolumn {
text-align: left;
padding-left: 40px;
margin-right: 3px;
width: 390px;
float: left;
background: transparent;
}
#rightcolumn {
width: 230px;
margin-left: 20px;
text-align: left;
float: left;
background: transparent;
}
#footer {
background-image: url("images/footer2.png");
background-repeat: no-repeat;
background-position: bottom center;
height: 60px;
text-align: left;
clear: both;
padding-left: 40px
}
</style>
</head>
<body>
<div id="wrap">
<div id="header"></div>
<div id="maintext">
<div id="leftcolumn">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</div>
<div id="rightcolumn">
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</div>
</div>
<div id="footer">
This is footer stuff
</div>
</div>
</body>
</html>
Because they are floated, #maintext essentially collapses. Adding a height: 100% to #maintext fixed the problem in IE, but not for Mozilla.
Yep you got it, though the height is Not "fixing" it for IE, IE will "auto stretch" anyway, the height is just curing some of IE's other layout problems, a width would do the same ;)
However what you need for compliant browsers is some way to clear the content of maintext and while there are such things as clearing divs and hacks, in your layout I would just float the maintext div with width 100%, (so helping IE at the same time) A Floated div will stretch to contain its floated children according the CSS Recommendations, so this way keeps everyone happy..
e.g.
#maintext {
background: #fff;
border: 2px #f00 dotted;
float: left;
width: 100%;
}
Suzy