Hacker News new | ask | show | jobs
by joshnh 4825 days ago
Hi, creator here. Unfortunately that's not how CSS works. See here for more information: http://joshnh.com/2012/10/12/how-does-line-height-actually-w...
1 comments

I read your article. But i am still wondering why you cant shift the pattern so that the lines really line up with the baseline. You can influence the leading via margin or padding and the line-height property, right?
Absolutely, you can hack it on a very individual basis, but this introduces some major problems. For instance, browsers and operating systems all render fonts differently, and as the web is fluid by nature, simply having a sentence break to the next line can be an issue. Also, it can be incredibly different based on the typefaces you are using.
then i still don't get it. When a simple line break would break a horizontal baseline-aligned grid, wouldn't it break a horizontal baseline-plus-some-space-aligned grid?

Although the css prop. "line-heigt" is not implemented in a convenient way, it is still deterministic as I understand from the quoted article:

"This is determ­ined by work­ing out the dif­fer­ence between the line-height and the font-size, divid­ing by 2, and then pla­cing the cal­cu­lated amount of space above and below each line of text."

Only if you are using line-height to hack together a print baseline on the web.

Let me put it this way, if there was a semi-reasonable solution, I'm sure you would have heard about it.