Note that there are some explanatory texts on larger screens.

plurals
  1. PO'Line-height: 1' in CSS reset causes HTML background to extend
    primarykey
    data
    text
    <p>I've been trying to figure out why there's a thin (maybe 1px) line at the bottom of my layout and finally pinpointed the <code>body {line-height: 1;}</code> in Eric Meyer's reset file. For some reason, this setting is causing the html element to extend just past my footer.</p> <p>I tried this out on a super simple page with just a main div with a background color of gray, setting the html background to red so I can see the line at the bottom of the window. Playing around with height settings on the main div, p tag, or an img, the line only disappears when the main div has a height setting. (I tried to use that information to fix my actual project, but it doesn't seem to work there...)</p> <p>I made a simple jsfiddle if you want to see what I'm talking about - <a href="http://jsfiddle.net/DFDj8/" rel="nofollow">http://jsfiddle.net/DFDj8/</a> - changing the <code>#main img {height: 800px;}</code> to just <code>#main {height: 800px;}</code> gets rid of the red line at the bottom. Commenting out the <code>line-height</code> setting in the reset does the same.</p> <p>Any thoughts on what's happening? If there's another post that explains this, feel free to link to it - I couldn't find anything similar. </p> <p>Thanks!</p> <p>*Updated jsfiddle with block-level footer as last element - <a href="http://jsfiddle.net/DFDj8/6/" rel="nofollow">http://jsfiddle.net/DFDj8/6/</a></p> <p>The code in jsfiddle contains Eric Meyer's reset plus the following:</p> <pre><code>html, body { background: red;} #main { background: gray;} #main img { height: 800px; display: block;} &lt;body&gt; &lt;div id="main"&gt; &lt;p&gt;paragraph paragraph&lt;/p&gt; &lt;img src="http://auntdracula.com/wp-content/uploads/2013/05/Delicious_Steaz_Soda.jpg" /&gt; &lt;/div&gt; &lt;footer&gt; &lt;p&gt;&amp;copy; 2013&lt;/p&gt; &lt;/footer&gt; &lt;/body&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.
 

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