views:

190

answers:

3

Here is the HTML Code:

   <div id="header">
   </div>
   <div id="container">
        <div id="leftbar">
        </div>
        <div id="content">
        </div>
   </div>
   <div id="footer">
   </div>

And here is what I want to achieved, even though it's not valid CSS, but I think you will understand my point:

    html,body
   {
     min-width:800px;
     max-width:1680px;
     width:100%;
     height:100%
   }
   #header
   {
     width:100%;
     height:100px;
     background:#CCCCCC url(images/header_bg.gif) repeat-x; 
   }
   #footer
  {
   width:100%;
   height:10px;
  }
  #container
  {
   width:100%;
   height:100%-100px-10px;   /* I want #container to take all the screen height left */
  }
  #leftbar  /*fixed width, the height is always the same as the screen height*/
  {
    height:100%;
    width:200px;
  }
  #content
  {
    height:100%;
    width:100%-200px;  /* take all the screen width left except the leftbar */
    overflow:auto;
  }

Someone just put this as an example: http://limpid.nl/lab/css/fixed/header-and-footer

Actually, I don't think using <body>padding to exclude the header and footer out is a good way to go, because I would like all the scroll bars appear inside the div#content, not for the whole <body> tag. I don't know if I explain my problem clearly. Thanks!

+1  A: 

The normal width of a block element is 100% so all you should need to do is add a margin as appropriate. If I'm understanding your question properly.

jarrett
Could you be more specific? Give a `margin-left:200px` to div#content? In that case, what's the width for div#content, if it's the default 100%, there is no way to put these two divs side by side.
WilliamLou
A: 

Have you considered using position:fixed for the framework elements? Or are you stuck supporing IE6?

thomas
A: 

the horizontal bit can be achieved quite easily

#content {margin-left:200px;}
#left-bar {float-left;width:100px;}

The vertical bit is trickier as there is no vertical equivalent of float. A close approximation that might work is:

html,body
{
     min-width:800px;
     max-width:1680px;
     width:100%;
     height:100%
   }
   #header
   {
     width:100%;
     height:100px;
     background:#CCCCCC url(images/header_bg.gif) repeat-x;
     position:absolute; 
    top:0;
    left:0;

   }
   #footer
  {
   width:100%;
   height:10px;
     position:absolute; 
    bottom:0;
    left:0;
  }
  #container
  {
   width:100%;
   height:100%;
   margin-top:100px;
   margin-bottom:10px;
  }
  #leftbar
  {
    height:100%;
    width:200px;
    float:left;

  }
  #content
  {
    height:100%;
    margin-left:200px;
    overflow:auto;
  }
wheresrhys