Hacker News new | ask | show | jobs
by sago 2557 days ago
I don't think it needs a new style. [Edit: I'm wrong, see reply below]. There is a CSS pseudo-element ::first-letter, which you can format and align as you wish. In the article they try to use this, but run afoul of the fact that different rendering engines disagree on how exactly it should be converted into a (CSS) box. In my experience you can get a lot further without having to use spans, but I also couldn't make it perfect.

I suspect it's just ultra low priority for folks making rendering engines. It doesn't make a lot of sense for web typography, and to me looks just downright daft if you're not going to pull in and accentuate the start of the first line, or if you're going to separate your paragraphs with blank lines. My personal feelings only of course, but it feels like a bastardisation between different eras of typography.

1 comments

:first-letter doesn't actually suffice to make good initial letters, either as implemented or as spec'd.

The initial-letters CSS property (maybe to be renamed?) is the future solution to this, and that should work fine with search. See https://drafts.csswg.org/css-inline/#initial-letter-styling

Can you say more what you mean by 'doesn't suffice'? There are certainly some forms of typographic initial I know it can't do. But if it worked consistently, it would be sufficient to achieve the effect that the article is attempting, wouldn't it?

Thanks for the link. I had no idea it was an active proposal.

Without knowledge of the fonts used, you can't get both ascender line and baseline aligned with respective lines of content, which is the traditional way of doing drop caps.

Sure, with web fonts and assumptions that the font always successfully loads and covers all graphemes in the text you can hardcode lengths to achieve proper alignment, but that's still a bit fragile.

The implementation in the article still used hard-coded lengths, perhaps this could have been fixed without the extra markup after all.