Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It can be done with CSS after all. You need to use <code>display:table</code> and have the content pane height at 100%. Unfortunately, you will also need an extra &lt;div&gt; inside header and content. JSFiddle link is here: <a href="http://jsfiddle.net/RBHXm/3/" rel="nofollow">http://jsfiddle.net/RBHXm/3/</a>. You may also add footer if you'd like: <a href="http://jsfiddle.net/DE8pA/3/" rel="nofollow">http://jsfiddle.net/DE8pA/3/</a></p> <p>You will also need to introduce padding to prevent <a href="http://complexspiral.com/publications/uncollapsing-margins/" rel="nofollow">margin collapse</a>. Otherwise things like &lt;h1&gt; will look funny.</p> <p>HTML:</p> <pre><code>&lt;div id="container"&gt; &lt;div id="header" &gt;&lt;div&gt;&lt;h1&gt;Header stuff&lt;br /&gt;here...&lt;/h1&gt;&lt;/div&gt;&lt;/div&gt; &lt;div id="content"&gt;&lt;div&gt;&lt;p&gt;content stuff here...&lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>/* colors to make the demo clear: */ #container { background: #ddd; } #header { background: #ddf; } #content { background: #dfd; } /* CSS provided in question: */ #container { position: absolute; left: 20px; top: 20px; height: 300px; width: 400px; } #header { width: 100%; } /* your fix: */ #container { display: table; } #container &gt; * { display: table-row; } #content { height: 100%; } #container &gt; * &gt; * { display: table-cell; padding: 0.01px; } /* optional styles to make it look pretty */ #content &gt; div { border: 2px solid green; } #header h1 { text-align: center; margin: 3px; color: blue; } </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. 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