I’m beginning to think this is impossible, but thought I’d ask you guys.
Basically it’s a 2 column layout, but the “business” wants the following:
-Always take up the entire browser window
-Accommodate resizing of browser window
-Left column will be fixed width, but that width should be flexible from page-to-page.
-Left column has a region at the top with fixed height.
-Left column has a bottom region. It should take up the remaining vertical space of browser window. If content is very large, it will have a scroll bar just for that region.
-Right column should take up remaining horizontal space of browser window.
-Right column has a region at the top with fixed height.
-Right column has a bottom region. It should take up the remaining vertical space of browser window. If content is very large, it will have a scroll bar just for that region.
I’ve tried everything…divs, floated, absolutely positioned, tables, divs in tables…
Is this even possible?
Here’s an image of what it should look like:
http://imgur.com/zk1jP.png
It’s not at all impossible, and you shouldn’t need javascript. You do need some IE6 specific hacks if you care about that browser.
The key to the layout is the fact that you can set one or more edge positions on an absolutely positioned element. Here’s a good article on the technique: http://www.alistapart.com/articles/conflictingabsolutepositions/
Here’s a demo: http://www.spookandpuff.com/examples/2col2section.html
and source:
There are a few tricks: First off, I only tested this in Firefox to give you the general idea – there are some needed fixes for IE which I haven’t added: check the list apart article up top for details.
I’ve allowed 10px extra space around all the boxes just to illustrate the idea – you’d probably set these to 0 in a real layout.
You can set the height of .topSection differently between columns with some rules like:
I would use a container with a class (or a class on the body tag) to specify the width of the left column, something like:
That allows you to define a set of width ‘templates’ you can switch between.