Note that there are some explanatory texts on larger screens.

plurals
  1. POContent 100% stretch
    text
    copied!<p>Im trying to do layout that has header, content and footer. Footer must be bottom of the page(done). But my problem is how can I get content 100% strech between header and footer. When my content is empty, then I can't see that, but when I'm writing some word to html in to content div, like "hello", then the content is only so long than the content in content. I guess you can understand what I mean. Can somebody explain what is wrong in my css code.</p> <p>Red is header, green is footer, cyan is content and blue is container. Problem is that Content does not cover the container area.</p> <p><img src="https://i.stack.imgur.com/iJZBE.jpg" alt="t"></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &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;Praktika1&lt;/title&gt; &lt;link rel="stylesheet" href="style1.css" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="header"&gt; &lt;/div&gt; &lt;div id="content"&gt; &lt;/div&gt; &lt;div id="footer"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS: </p> <pre><code>@CHARSET "UTF-8"; *{padding:0; margin:0;} html,body{ height:100%; } #container{ width: 1024px; position:relative; background-color:#cce; margin: 0 auto; min-height:100%; } #header{ width: 1024px; height:100px; background-color: #CCC; } #content{ height:100%; width:1024px; background-color:yellow; } #footer{ width: 1024px; height: 100px; position:absolute; bottom:0; background-color: #ced; } </code></pre>
 

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