Open MatsPalmgren opened 5 years ago
Ugh. Personally, I'd say no because it breaks up the word more than other uses. But there's at least one person in the world who wanted this effect.
My first thought was that it would be possible to do this with a ::first-letter { float: left; clear: left; } but that does not work because clear does not apply to first-letter. It seems like anything that allows float should also take float-related properties. Perhaps that's an oversight that should be fixed? (whether or not we allow this for initial-letters)
@astearns though I agree on anything accepting a float also accepting float-related properties, I have achieved this affect by setting margin-right: 100%
with line-height: 1
on top of float: left
. So, achievable, yes, but not as clean as the vertical rhythm of initial-letter
.
BTW, this magazine uses a lot of creative initial letter styles. I've also seen examples of a (drop) initial letter that spans all lines of the first paragraph, i.e. something like initial-letter: drop all
.
I'm not sure zero sink would get you that line break there? Probably the best way to handle this is a sink of 1 plus wrap-after: always https://www.w3.org/TR/css-text-4/#wrap-before
I'm not sure zero sink would get you that line break there?
I didn't suggest there's an actual line break there (see below)... The offset could just be an implied layout effect from having a zero sink.
Probably the best way to handle this is a sink of 1 plus
wrap-after: always
The disadvantage is that it makes the initial-letter not part of the first line. ::first-line
would only include the initial-letter for example. That's not the case for initial-letters without a wrap-after: always
style. To me, the first letter [in the example screenshot above] is semantically part of the first line even though it's rendered above the remainder of the line. The red color kind of emphasizes that too. Compare for example initial-letters: 1 2
- that letter is still on the first line although it's rendered completely below it.
(Also, a minor limitation of using wrap-after
is that you must use a legacy ::first-letter
to apply it (which is a subset of initial-letter
use cases, IIRC).)
Here's a second example from a different magazine:
I didn't really have a supporting argument for my point 8 at https://github.com/w3c/csswg-drafts/issues/4171, suggesting it might be useful to allow setting the font size on the initial-letter
. But I think I've just found one.
This looks like a case where font-size: 50vw
is an improvement over initial-letters: 15 0
I am assuming the size of the glyph should be the same for initial-letters: 15 0
and initial-letters: 15 1
. The effect in most cases would just be moving the following text one more baseline down and not wrapping. But if there are descenders and https://drafts.csswg.org/css-inline/#initial-letter-exclusions applies, the following text would need to be moved even lower (in line-height increments) to avoid the collision.
The CSS Working Group just discussed [css-inline] initial-letter should allow zero sink?
, and agreed to the following:
RESOLVED: allow sink of 0 for initial letters
I have no idea how to draft the layout model for this in a way that makes sense.
@fantasai can you outline or list the problems you’re seeing?
@astearns The box models that we have been discussing so far assume that the initial letter is part of the content of the first line, so I'm not sure how floating it above that line such that the first line's content flows underneath would actually work. Particularly if that first line has content that is larger than the root line box.
https://drafts.csswg.org/css-inline/#valdef-initial-letters-integer "Values less than one are invalid. "
FYI, here's an initial letter style from a printed magazine "The Guardian Weekly" vol.200 No.8: which appears to use something like
initial-letter:15 0
. Is this use case something that the spec should address?