[csswg-drafts] [css-display] Should anonymous boxes really inherit through the box tree?

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-display] Should anonymous boxes really inherit through the box tree? ==
[CSS Display](https://drafts.csswg.org/css-display/#intro) says

> anonymous boxes (which only exist in the box tree) inherit through their box tree parentage

I think this implies an anonymous box doesn't inherit from its parent element if the parent has [`display: contents`](https://drafts.csswg.org/css-display/#valdef-display-contents), because that means

> The element itself does not generate any boxes

For example,

```html
<section>
  <div>Foo</div>
</section>
```
```css
section {
  color: red;
}
div {
  color: green;
  display: contents;
}
```

Foo is wrapped inside an [anonymous inline box](https://www.w3.org/TR/CSS2/visuren.html#anonymous), so according to the quote above, it should inherit the red color from its parent box, which is the one of the section, because the div does not generate boxes.

But this seems wrong, because if we had

```html
<section>
  <div><span>Foo</span></div>
</section>
```

then the span would inherit the green color from the div through the element tree.

In Firefox and Chromium the text in the first example is green as expected, I think it's just that the spec is confusing.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1118 using your GitHub account

Received on Wednesday, 22 March 2017 16:05:43 UTC