This is known as elastic layout design and is very useful for variable layout sizes.
You can use the min-width and max-width css properties. The only problem is that they do not work with IE6.
Well, there is a min-width hack for IE6, but maximum width effect won't work for IE6 on its own.
Basically.
The HTML:
Code:
<div id="wrapper">
<div id="left"></div>
<div id="right"></div>
<div id="center"></div>
</div>
And the CSS:
Code:
#left,#right { width:100px; }
#left { float:left; }
#right { float:right; }
#center { max-width:500px; }
This works, but IE6 won't like it. So in order to make it work with IE6 then you should use write a JavaScript onresize event which determines the size of the center box and sees if it goes over 500px.
Something like this:
Code:
* html #center { width:auto; }
* html #center.tooBig { width:500px; }
Then in Javascript
Code:
var centerDivWidth = ...
if(centerDivWidth>500)
centerDivWidth.className='tooBig';
else
centerDivWidth.className='';
Bookmarks