-
Notifications
You must be signed in to change notification settings - Fork 709
[css-inline] initial-letter appliance and inheritance #2184
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
Comments
OK, so @dauwhe and I checked in some edits to define this a little more precisely. You can read the new definition here: https://drafts.csswg.org/css-inline-3/#first-most-inline-level Agenda+ for review. @Loirooriol Let us know if we missed anything or if this should be resolved another way. |
Much better, but it's still not much clear what happens when
I can't find the proper definition of this. Also, the interaction will probably depend on #2243. And this definition
seems to mean that any first child of an inline box that is itself a “first-most inline-level descendant” of the block container is also a “first-most inline-level descendant” of that block container, even if the first child is not inline-level (remember #1477, an inline box can have block-level children). And I think it would be clearer without recursivity, e.g.
|
I think you missed “However, the Anyway, your rewording looks better in multiple respects. I'll try to work it in. |
OK, checked in 412bfea which isn't the same as your wording because I tried to tighten up some of the related restrictions. Also broke up the sentences a bit and rearranged things so that we don't need the throw-away term. Let me know if it's up to snuff! |
I missed that indeed, thanks. The new wording looks better, and thanks for the acknowledgment! But still a bit concerned about edge cases of <div><span>‘</span>T</div> div::first-letter { initial-letter: 2; }
span { initial-letter: 3; } then CSS pseudo allows the above to generate this tree:
Note Maybe you can handle this with
|
…t the start of the line. #2184 (comment)
Didn't want to leave it quite that open (otherwise people might ask about margin-left or some other layout-time thing), so added “or otherwise preceded by other inline-level content”. @Loirooriol Let me know if that works. :) |
@fantasai It's good. Just one last point about nesting:
This seems to allow |
Not sure if this could be a problem: <div>
<span style="initial-letter: 3">Foo</span>
<p>Bar</p>
</div> The |
The Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: box tree nesting vs initial-letter<fantasai> github: https://github.com//issues/2184#issuecomment-391832514 <frremy> fantasai: we didn't define very clearly what we defined as "the first inline" <frremy> fantasai: so, it's slighly weird, because adding spans should not change result most of the times <frremy> fantasai: but in this specific case, if they are nested, it's not clear which one to take <dauwhe> https://github.com/w3c/csswg-drafts/commit/412bfeabf53c980babe9845c3a2684904790c2e2 <frremy> fantasai: (looking at notes and issues) <fantasai> “ Specifically, initial-letter also applies to any inline-level box that is the first child of its parent box and whose ancestors (if any) that are descendants of its containing block are all first-child inline boxes that have a computed initial-letter value of normal. ” <frremy> florian: if you have multiple spans, the outer one does have a border, but the nested one has initial letter <frremy> florian: does the border wraps around the "nested" initial letter? <frremy> Rossen: I would assume not <frremy> florian: so it becomes out of flow, kinda? <frremy> Rossen: yes <frremy> fantasai: (reads pasted in text) <frremy> florian: there are two options (1) you take the nested span out of flow (2) or we can refuse to initial letter any nested span inside something that has a border <frremy> Rossen: the second options is though from the styling point of view <frremy> florian: ok, then let's do 1 <florian> s/something that has a border/something that has a margin, border, or padding/ <frremy> PROPOSED: the initial letter will be the first inline that has intial-letter not set to normal, (+details in the spec) <frremy> Rossen: any objection? <frremy> RESOLVED: the initial letter will be the first inline that has intial-letter not set to normal, (+details in the spec) <dauwhe> see https://github.com//issues/743 <frremy> PROPOSED: the content of the initial letter will behave as if was taken outside of its inline ancestors <fantasai> s/content of the// <frremy> PROPOSED: the initial letters will behave as if was taken/rendered outside of its inline ancestors <frremy> RESOLVED: the initial letters will behave as if was taken/rendered outside of its inline ancestors |
…arents, geometrically-speaking. #2184
OK, committed changes. @Loirooriol would you mind reviewing to make sure I handled all your concerns? :) |
@fantasai It looks good, assuming that anonymous block containers establish a containing block (#2184 (comment)), which technically it's what CSS2 says. I just want to confirm because no CSS3 spec seems to ratify that anonymous block containers are skipped for percentage resolution, and not sure whether anonymous block containers establish a containing block or not has been observable until now. |
@Loirooriol OK! Closing out this issue, follow-up in #3217. |
initial-letter
does not inherit and applies toThe problem is that the inline-level first child box of a block container is the root inline box, which cannot be targeted using selectors.
If the definition refers to the first child in the element tree then that's a problem with
display: contents
. And if you have<div><b><i>Text</i></b></div>
, it's not clear whyinitial-letter
applies tob
but not toi
.In any case, since there is no inheritance, it's not clear what happens if you set
initial-letter
both to that first child and to the block container's::first-letter
, or to nested::first-letter
s.Instead, I think there are three reasonable possibilities:
initial-letter
only applies to block containers that establish an inline formatting context, and affects the initial letter of the block container. But note that often the block container that establishes the IFC is an anonymous one, soinitial-letter
should inherit.initial-letter
only applies to innermost::first-letter
pseudo-elements, but it inherits, so you can set it on a block-level, inline-level or::first-letter
parent box.initial-letter
only applies to innermost::first-letter
pseudo-elements. And that's all because it doesn't inherit.The text was updated successfully, but these errors were encountered: