Why isn't the CSS property 'line-height' letting me make tight line-spaces in Chrome?

Simon Suh picture Simon Suh · Sep 15, 2011 · Viewed 24.1k times · Source

I have a paragraph tag that I defined elsewhere with a line height of 15px, and I have another paragraph tag further down the page where I want to make the line height around 10px. Funny thing is, it won't let me get down to 10px or anything smaller than that, but when I set it to 25px or higher, the line-height property seems to be working.

I checked the relevant CSS (all hand-coded) via the Chrome browser's web developer tools (Chrome's version of Firefox's Firebug) and couldn't find anything relevant. Is there a common CSS bug that prevents me from shrinking the line-height beyond a certain minimum amount?

Answer

mhenry1384 picture mhenry1384 · Aug 31, 2012

I've noticed in both Firefox and Chrome that if you set the HTML5 doctype there's a minimum line-height for inline elements. For block elements you can set the line-height to whatever you want, even make the lines overlap.

If you don't set the HTML5 doctype, there's no minimum line-height for either block or inline elements.