[csswg-drafts] [css-display][css-cascade] Should `display: contents` affect inheritance?

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

== [css-display][css-cascade] Should `display: contents` affect inheritance? ==
[`display: contents`](https://drafts.csswg.org/css-display/#valdef-display-contents) replaces an element by its children, so I wonder if the children should still [inherit](https://drafts.csswg.org/css-cascade-4/#inheriting) from that element.

I think it would make more sense if they didn't (except maybe for the `display` property itself?). But on Firefox and Chrome, the inheritance is not affected.

Example (https://jsfiddle.net/xyeL8ewr/):

```html
<div>
  <p>
    <span>Foo</span>
  </p>
  <span>Bar</span>
</div>
```
```css
div {
  color: blue;
}
p {
  display: contents;
  color: red;
}
```

"Foo" is red and "Bar" is blue. But with `display: contents`, it's like if the markup was

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

so maybe both should be blue.

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

Received on Sunday, 12 March 2017 20:26:09 UTC