I'm trying to get a dynamically sized sidebar to float in the upper right portion of my web pages (but below the header and nav) and have the main content on the page flow around it (sort of in an "L" shape except with the bottom part of the "L" really thick). The width and height of the sidebar will vary from page to page so I can't use any hard values.
My css looks like:
main {
width: 850px;
height: auto;
}
sidebar {
width: auto;
float: right;
}
(plus some padding, margin, and background color code I think is inconsequential)
My html looks like:
<div id="wrapper">
<div id="header"> /* header stuff */ </div>
<div id="nav"> /* nav stuff */ </div>
<div id="sidebar">
/* my sidebar content, really just an h3 and a ul */
</div>
<div id="main">
/* lots of content here */
</div>
</div>
I don't completely understand why I have to have the sidebar div first, but it this code works fine in FF, Chrome, Safari (Windows), and IE8. But on IE7 (and IE6, which I don't care about), the main content gets pushed down below the bottom of the sidebar, as if there was a "clear: left" on the sidebar div (but there isn't).
I have a feeling this is one of those evil IE7 non-compliance bugs, especially because IE8 behaves exactly like the other browsers. But I have no idea how to fix it.
Any ideas? TIA.