Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a content div that (1) stretches to the bottom of viewport and (2) has a 20px margin?
    primarykey
    data
    text
    <p>What I am trying to create:</p> <pre><code>+--------------+ | 20px margin | | +--------+ | | | | | | | Faux | | | | | | | +--------+ | | | +--------------+ </code></pre> <p>The outer square is the browser viewport. I need to create a webpage that stretches to the bottom even if there is no content, but the page should be surrounded by a 20px margin:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt; &lt;style&gt; * { margin: 0; padding: 0; } html, body { height: 100%; background: #ccc; } body { margin: 20px; } #wrapper { width: 100%; background: #fff; min-height: 100%; } #header { height: 80px; } #faux { height: 100%; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;div id="header"&gt;Header&lt;/div&gt; &lt;div id="faux"&gt;Faux&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>However, this code gives me a vertical scrollbar. This is probably due to IE 10 calculating the height as <code>100% + 20px</code> but I need it to be <code>100% - 20px</code>, so that there is no scrollbar is the content of the page does not exceed the browser viewport. I have tried a negative margin of 20px on <code>#wrapper</code> but this did not work.</p> <p>How can I get rid of the vertical scrollbar?</p> <p>BTW: I am indifferent of the way the page is built at this stage. <code>#header</code> is now outside of <code>#faux</code> but if it makes more sense to place it inside <code>#faux</code> (or if it necessary for the design to work) then please rearrange the divs :-)</p> <p>Any help is greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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