tags:

views:

47

answers:

2

basically my html code looks like:

 <div id="leftbar"></div>
 <div id="content"></div>
 <div id="rightbar"></div>

how do i code it with css so that the all 3 divs will be side by side and leftbar and rightbar have a fixed width while content will be flexible to fill out the webbrowser.

+2  A: 

Float the leftbar left, and give content a margin-left value equal to (or greater than) the width of the leftbar. Float the rightbar right, and give content a margin-right value equal to (or greater than) the width of rightbar.

.nav1    { width:200px; float:left; }
.nav2    { width:200px; float:right; }
.content { margin:0 210px; }
.clear   { clear:both; }

--

<div id="wrapper">
  <div class="nav1">Main Nav Items</div>
  <div class="nav2">Other Nav Items</div>
  <div class="content">Content goes here</div>
  <div class="clear"></div>
</div>
Jonathan Sampson
but its something wrong with this approach. when i minimize the browser the rightbar moves beneath everything.
weng
+1  A: 

Try this: http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

How about this one: http://www.glish.com/css/7.asp

Joel Etherton
that page doesnt make fixed width columns blended with flexible columns
weng
@noname: added a different one. Note, there are several different layouts on the mathewjamestaylor.com site, one of which is what you're looking for if you poke around.
Joel Etherton
thanks...looked like very good tutorials!
weng
worked perfectly. saved me a lot of time, just copy and use. should be like this, cause i as a web developer just want to mind critical functions and not reinvent the wheel all the time. do you got other useful links to css/html to save time?
weng
Actually I always start with glish. He has a set of links somewhere on his /css site that has a complete list of tutorials. Some are still there, but a lot are link-rotted.
Joel Etherton