Basically the container is to have a width of 100% (i.e. it will fill the whole of the page) and it will have two columns:
- column 1 is the nav bar and should remain a fixed width, e.g. 200px
- column 2 is the content area and should have no specific width – it should just fill the remaining area and adjust according to screen/window sizes
What is the best way to accomplish this?
XHTML:
<body>
<div id="container">
<div id="navbar">
</div>
<div id="content">
</div>
</div>
</body>
CSS:
#container { float: left; width: 100%; }
#navbar { float: left; width: 200px; height: 800px; }
#content { float: left; height: 800px; ??? }
The way I would do it is to set a minimum width on the container and content divs, with a left margin on the content div that allows it to slide next to the nav div. The left margin plus the minimum width should equal the minimum width of the container. I’ve added border so you can see that it sizes correctly.
Fiddle at http://jsfiddle.net/bmMTW/