I am trying to make a lined paper effect for my personal blog, but I have run into a snag getting each line to render on one of the actual lines on the paper. Everything starts out just right, but rounding errors seemed to accumulate as the lines go down the page. I had set the line height to 24px, and added padding to elements that was 24px, basically just trying to make sure any thing that added height was a multiple of 24 so that all the lines rendered correctly. But I found that chrome is not respecting the line height property exactly. Can anyone explain the screenshots below?
Here is basically the effect I am going for, as you can see it is pretty close.
But if you take a look at the height property, it is 70.909..., when it should actually be 72 (24 * 3). So Basically my question is, why is the height of the <p>
[6char] not a multiple of the line height?
Here is the CSS computed style for a <p>
element in text:
font-size:16.363px;
height:70.909088;
line-height: 24px;
padding-top: 24px;
margin:0px;
padding-bottom:0px;
styling. It's not unlikely that they're using ems instead of px somewhere. You'll want to check all the attributes that impact the box geometry, too, not just line-height. http://v1.jontangerine.com/silo/css/pixels-to-ems/
– broofa Dec 12 '12 at 02:43