There is a demo page with two block-level elements, namely h1
and h2
. I try to put all baselines exactly on the grid in a cross-browser way, but I fail with the second heading.
For the h1
, I have experimented with margin-top
and found that its value can be set between 1.5px
and 1.85px
—then the heading snaps to baselines in all browsers.
But trying to find a similar range for the margin-top
of h2
, I reached a deadlock. In most browsers (e.g. Chrome or Safari) the appropriate range turned out to be 4px
to 4.99px
. But in Firefox on Windows (and only on Windows) it is 3px
to 3.99px
. So there is no intersecting subrange for possible values of margin. If the heading is perfectly snapped in one browser, it misses by exactly 1 pixel in the other.
Can you suggest any solution?