Skip to content

[css-display][css-cascade] Should display: contents affect inheritance? #1098

Closed
@Loirooriol

Description

@Loirooriol

display: contents replaces an element by its children, so I wonder if the children should still inherit 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/):

<div>
  <p>
    <span>Foo</span>
  </p>
  <span>Bar</span>
</div>
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

<div>
  <span>Foo</span>
  <span>Bar</span>
</div>

so maybe both should be blue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.css-display-3Current Work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions