Forum Moderators: not2easy
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
}
#sidebar {
padding: 0;
margin: 0;
height: 500px;
width: 370px;
float: left;
border-right: 1px solid #000;
background: #DAECA1;
}
#content {
padding: 0;
margin: 0;
height: 500px;
margin-left: 370px;
background: red;
}
</style>
</head>
<body>
<div id="sidebar">
</div>
<div id="content">
</div>
</body>
</html>
Thankyou. When I first implemented the hack by adding
* html #sidebar {
height: 1%;
}
it didnt work. Removing height: 500px; from #content made it display correctly.
Any thoughts on this?
EDIT: When adding content into #content such as
#orange {
height: 40px;
background: blue;
}
<div id="orange"></div>
There is still the 3 pixel gap. Adding a red background to #content shows that the hack worked partially, but i'm not sure what to do when it comes to adding content.
body {
margin: 0;
padding: 0;
}
#sidebar {
width: 370px;
float: right;
border-left: 1px solid #000;
background: #DAECA1;
}
* html #sidebar {
height: 1%;
}
#content {
margin-right: 370px;
background: red;
}
#orange {
height: 40px;
background: lightblue;
border-bottom: 1px solid #000;
}
<div id="sidebar">
<br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
<div id="content">
<div id="orange"></div>
<br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
height: 1%; to everything inside the #content, the non-floated section. Thus:
#sidebar { float: right;
width: 370px; }
#content { margin-right: 370px; }
Then IE 6 only (using conditional comments or something similar, PiE uses the tan hack with the backslash hack combined):
#content * { height: 1%; } This will set every object within
#content to that height, which, by PiE's article, fixes it.