I find it awkward to create layouts like this that have good semantics.
The left side is a column about 150 pixels wide which contains navigation elements.
I would like to put the HTML for this section of the site at the beginning of the HTML code, and then have an easy way to force the rest of the page not to encroach on that territory on the left (the 150 pixel column).
I have thought about some options.
- Place rest of site content inside a div which explicitly has a left-margin of 150px.
- Set the nav element to width 150px and float left. The rest of the page naturally wraps.
Are there other options that are more suitable for this task?
Here are the cons.
- Changing the nav element to 200px now requires me to edit the left-margin of the other div to 200px. Sure, this isn't too bad for a one-time layout change, but what if I had the nav element's width dynamically change from script? I would need the script to also change the margin of the div.
- If the nav element is set to position:fixed (and made to occupy the entire left column of the page) the rest of the page's wrapping does not accomodate its now stationary behavior and it looks terrible when the page is scrolled. To fix this I need to make the nav element infinite height. I am not sure how to do this the right way.
height:9999999px;
? That makes my page 10 million pixels high and the scrollbar is now useless.