Skip to content

[css-display] display: contents can't just compute to display: none on replaced elements #14102

Description

@Loirooriol

https://drafts.csswg.org/css-display-3/#valdef-display-contents

This value computes to display: none on replaced elements

First, at computed value time it's not known whether an element will be replaced or not, so it seems this should be "behaves as" instead.

But then, browsers aren't doing that either:

<!DOCTYPE html>
<style>
div {
  display: block;
  width: 100px;
  height: 100px;
  content: linear-gradient(cyan);
  border: solid;
}
</style>
<div>text</div>
<div style="display: contents">text</div>
Gecko, Blink, WebKit Servo
Image Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions