小编Oma*_*rio的帖子

Css ">" selector and "display:contents", what is the expected result?

I'm working with CSS' display:contents paired with element>elementselector. As for the definition, the display:contents property:

Makes the container disappear, making the child elements children of the element the next level up in the DOM

So I have this example code:

.wrapper {
  background-color: red;
}

.hidden {
  display: contents;
}

.wrapper > .child {
  background-color: yellow;
}
Run Code Online (Sandbox Code Playgroud)
<div class='wrapper'>
  <div class='hidden'>
    <div class='child'>I'm a child</div>
    <div class='child'>I'm a child</div>
  </div>

  <div class='child'>I'm a child</div>
  <div class='child'>I'm a child</div> …
Run Code Online (Sandbox Code Playgroud)

html css html5 css-selectors css3

1
推荐指数
1
解决办法
97
查看次数

标签 统计

css ×1

css-selectors ×1

css3 ×1

html ×1

html5 ×1