Note that there are some explanatory texts on larger screens.

plurals
  1. POrelative and absolute positioning in IE and FF
    primarykey
    data
    text
    <p>I want to have a div that grows when you add more content in it, has at least the height of the viewport and has a header and a footer sticking to the top and bottom. I came up with the following which works fine in IE7 but doesn't work in ff3.5.</p> <p>This is the HTML (add repeated 'Lots of text<br>' for main_body to grow out of the viewport):</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"&gt; &lt;title&gt;Testing 123&lt;/title&gt; &lt;link rel="stylesheet" href="css/testing.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main_body"&gt; &lt;div id="header"&gt;&lt;/div&gt; &lt;div id="content"&gt; Lots of text&lt;br&gt; &lt;/div&gt; &lt;div id="footer"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;html&gt; </code></pre> <p>This is the css:</p> <pre><code>* { margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; border: none; z-index: 10; font-family: Arial; font-size: 20px; text-decoration: none; text-align: left; } html, body { height: 100%; background-color: rgb(255, 255, 255); } #main_body { position: relative; min-height: 100%; height: auto !important; height: 100%; margin: 0px 20px 0px 20px; } #header { position: absolute; top: 20px; left: 0px; height: 50px; width: 100%; background-color: rgb(40, 40, 40); } #content { margin: 80px 10px 50px 10px; } #footer { position: absolute; bottom: 20px; left: 0px; height: 20px; width: 100%; background-color: rgb(40, 40, 40); } </code></pre> <p>I think this should work according to specs. And it does in IE but not in ff3.5. Pleae help.</p> <p><strong>EDIT:</strong> I found out (thanks to Jeepstone) that it works fine when I change margin to padding in #content. </p>
    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. This table or related slice is empty.
    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