w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.51k stars 670 forks source link

[css-content] Does `content: none` on element suppress box generation of children? #2637

Open upsuper opened 6 years ago

upsuper commented 6 years ago

The spec currently says the following for content: none:

On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty.

while for <content-replacement> and <content-list> it says:

(On elements, their) normal contents are suppressed and do not generate boxes, as if they were display: none.

It is unclear to me whether content: none should suppress boxes as well.

On the one hand, "as if the element was empty" seems to indicate that all the children should behave as if they were display: none so that the element behaves as if it's empty. On the other hand, "this inhibits the children of the element from being rendered" seems to indicate that it would just cause the children not to be rendered, like what visibility: hidden does but cannot be overridden by children.

I suppose content: none should suppress children from generating boxes just like the other two values. The spec should make it clearer.

If the spec intends to mean just skipping rendering (rather than suppressing generating boxes), it should probably make a note there explicitly mentioning the difference. Although I don't think this is a good idea.

emilio commented 6 years ago

content: none on pseudo-elements right now also suppresses the pseudo-element. Should content: none behave as display: none?