I have two <div> elements that I want to position side by side like the following:
+------------+---------+
| navigation | content |
+------------+---------+
I want the navigation <div> to be as large as required, but not larger (shrink-to-fit behaviour). The content <div> then should fill the remaining space.
How do I achieve this positioning with CSS without specifying percentage ratios such as 20% / 80%?
The Code:
The Explanation:
Really, this is easy enough to understand. You simply have two
divs. The navigation hasfloat: left– this allows the rest of the content to float around it. The content then hasoverflow: hiddento force it into one column. IE6 will not honor theoverflow: hidden, though the float will still work.Check it out at jsFiddle