There is a plethora of CSS column layout information, but it all seems to rely on at least some of the columns having a fixed width (or percentage) which the others can then be based off.
What I'm trying to accomplish is a three-column layout, with the left and right columns being variable width (they could have anything in them) but being stuck to the left and right respectively. The centre column then should expand to take up any remaining space between them. I.e. if the right column has nothing in it, the centre column would then expand to the right of the screen.
Here's a quick shop to demonstrate:
You can (ab)use tables to help you out with this sort of layout. The basic idea is to set a table width to 100% (or a fixed value if you prefer), one column width to 100%, and let CSS determine how much space the other cells need. Here's a quick JSFiddle:
The CSS is basically:
Notes:
If you don't mind to put the center element after left and right columns you could do something like this:
Just float the side elements, and for the middle one just add an overflow (could be
hidden
orscroll
).Here's the fiddle: