Today I read an article about CSS Typography and how to set up a simple baseline grid. I thought it could be fun to try so I set everything up, but apparently it's not looking as expected.
Here is the fullscreen fiddle: http://jsfiddle.net/j5Tav/embedded/result/
And with code: http://jsfiddle.net/j5Tav/
To visualize the baseline I use Baseliner as a bookmarklet. It displays a baseline using JavaScript.
As you can see from my SCSS code, I set the baseline to 21px at a font size of 14px:
/* Reset */
* { margin: 0; padding: 0; }
/* Variables */
$bodyFontSize: 14px;
$baseline: 21px; /* 1.5 for 14px */
body {
font-size: $bodyFontSize;
line-height: $baseline;
}
article {
margin: 0 auto;
width: 65%;
}
h1,
h2,
p {
margin-bottom: $baseline;
}
h1 {
font-size: $bodyFontSize * 2;
line-height: $baseline * 2;
}
h2 {
font-size: $bodyFontSize * 1.8;
line-height: $baseline * 1.8;
}
Still, when you use Baseliner on the full screen fiddle and enter 21 into the bookmarklet, the baseline is totally off. Why? Did I calculate anything wrong?