-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-pseudo] ::first-line and line-height #2282
Comments
CSS 2 says that However, it seems CSS Inline tries to explain this behavior by introducing a root inline box that inherits the Then, the question is: how do the root inline box and So if the strut no longer exists and the fragment in the first line of the root inline box inherits from See bug 1427241.
But a |
So I guess this is the practical impact of @Loirooriol’s question in #1384. :) |
The CSS Working Group just discussed
The full IRC log of that discussion<dael> Topic: [css-pseudo] ::first-line and line-height<dael> github: https://github.com//issues/2282 <dael> fantasai: Is ::first-line about to effect root inline elemnt fragment. Then an issue about if line-height can be changed about first-line. Same question. <dael> fantasai: Seems to me letter it effect makes sense. Prop: root inline fragment on the first line is inside the ::first-line and therefore is effected by changes in size <dael> oriol: Clarify, it's not jsust being able to change line-height, but also set smaller then line-height in the block container or is block container the min value <dael> Rossen_: Currently block container is the min and the prop here allow it to be smaller <dael> oriol: Depends on impl. In FF block cotnainer is a min but in chromium you can reduce to smaller <Rossen_> q? <dael> Rossen_: Which are we prop to change to? chromium or FF? <dael> oriol: I think fantasai proposed chromium <dael> Rossen_: So ability to set sizes smaller than block container <dael> Rossen_: Additional comments or feedback? <dael> RESOLVED: Align with chromium behavior for ::first-line and line-height |
Specs: https://www.w3.org/TR/css-pseudo-4/#first-line-pseudo
The part of the specs related to the issue raised:
I'm opening this ticket because I've recently used the
::first-line
pseudo element and realized that theline-height
property for that pseudo element:A short code sample to explain: https://codepen.io/OxyDesign/pen/bc9238f85b871ba1059bc43c953c7a46
(The pseudo element
::first-line
has a smallerline-height
)line-height
line-height
line-height
but only if the line is not broken with a<br>
, in that case it doesn't apply the reducedline-height
So that might not be really clear on that point because each browser seems to have its own interpretation.
The second point is that the specs says that it should "behaves similar to that of an inline-level element". I was expecting this to behave as a block-level element. I understand that
::first-letter
should behave as an inline-element as it's part of the text content of a block and is just a part of the line. But::first-line
is clearly supposed to use the whole width available. Anything that is on this line is included in the::first-line
definition, therefore should behave like a block in my humble opinion.The code samples shows that the first line has a smaller
font-size
, so indeed I wanted to apply a smallerline-height
which is not applied by FF and (partially) by Safari because as an inline-level element it shouldn't. But I think this behavior would make only sense for the::first-letter
as it's part of a line and we don't want the line to be shrink by the::first-letter
'sline-height
. But in the::first-line
case there is no possibility that any other content would be in the same line without being a part of the::first-line
pseudo element so that shouldn't behave like that I think.The text was updated successfully, but these errors were encountered: