I'm trying to make a *very* simple layout:
Code:<div id="page"> <div id="menu"> <!-- menu --> </div> <div id="content"> <!-- content --> </div> </div> #page +--------+----------------------------+ | #menu | #content | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +--------+----------------------------+
#menu should be hard-coded at 150px.
#content should auto-stretch to take up the rest of the screen.
The twist?
#menu is secondary navigation that may or may not be on any given page. When it's *not* on a page, I'd like for the content area to stretch and take up the entire screen, thusly:
I initially thought, "Simple! I'll just float both columns left!" which works beautifully in Internet Explorer, but falls flat on its face with Firefox/Opera (the menu always appears *above* the content).Code:<div id="page"> <div id="content"> <!-- content --> </div> </div> #page +-------------------------------------+ | #content | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------------------------------------+
All solutions I've seen either have you hard-coding the width of both the menu and the content area (either in percentages or in pixels), or hard-coding the size of the lefthand margin. When the menu is missing, this either causes a big gap to appear where the menu used to be, or causes the content to be shrunk down to its normal size on the page, rather than stretching to the screen width.
Hoping I'm missing something stupid... thanks in advance for any help.









Bookmarks