ìì ê²°í©ì
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
ìì ê²°í©ì(>)ë ë ê°ì CSS ì íì ì¬ì´ì ìì¹íì¬ ë¤ìª½ ì íìì ììê° ì쪽 ì íì ììì ë°ë¡ ë°ì ìì¹í ê²½ì°ìë§ ì íí©ëë¤.
css
/* List items that are children of the "my-things" list */
ul.my-things > li {
margin: 2em;
}
ë¤ìª½ ì íìì ììë ì쪽 ì íì ììì ë°ë¡ ìëì ìì¹í´ì¼ íë¯ë¡, DOM í¸ë¦¬ì ê¹ì´ì ìê´íì§ ìê³ ìëì 모ë ìì를 ì ííë ìì ê²°í©ìë³´ë¤ ë ì격í©ëë¤.
구문
selector1 > selector2 { style properties }
ìì
>CSS
css
span {
background-color: white;
}
div > span {
background-color: DodgerBlue;
}
HTML
html
<div>
<span
>Span #1, in the div.
<span>Span #2, in the span that's in the div.</span>
</span>
</div>
<span>Span #3, not in the div at all.</span>
ê²°ê³¼
ëª ì¸
| Specification |
|---|
| Selectors Level 4> # child-combinators> |