Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The only solution that immediately comes to mind is display:table-cell, though you run into the problem of lack of support in ie6 &amp; ie7. Perhaps providing the rule for good browsers, and some javascript to calculate differences in height for ie?</p> <p>Edit: </p> <p>Here's another approach - using jQuery to calculate the offset. Bear in mind this is just a quick &amp; dirty attempt - it would need to be browser tested and you'd want some simple error handling etc., but it could be a starting point.</p> <p>Not sure if javascript is the way you want to go but I can't see it being done in pure css. </p> <p>I changed the ids to classes so that you can have multiple 'fixedHeight' boxes: </p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'&gt;&lt;/script&gt; &lt;script&gt; $(function() { $(".fixedHeight").each(function() { var head = $(this).find(".head"); var body = $(this).find(".body"); var foot = $(this).find(".foot"); body.css("margin-top", head.height()).css("margin-bottom", foot.height()); }); }); &lt;/script&gt; &lt;style&gt; .head { background-color: red; position: absolute; top: 0; width:100%; } .body { background-color: blue; color: white; overflow: auto; position:absolute; top:0; bottom:0; width:100%; margin:2.5em 0; } .foot { background-color: green; position: absolute; bottom: 0; width:100%; } .container { background-color: #aaa; border: 10px solid orange; height: 300px; width: 30%; position: absolute; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container fixedHeight"&gt; &lt;div class="head"&gt; &lt;h1&gt;Header Content&lt;/h1&gt; &lt;/div&gt; &lt;div class="body"&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;p&gt;Body Content&lt;/p&gt; &lt;/div&gt; &lt;div class="foot"&gt; &lt;p&gt;Footer Content&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload