: 부모 자식 관계인 두 셀터를 '>' 기호로 조합한 형태
div > strong { color: blue; } div > div > strong{ color: violet; }
: 자손 관계인 2개 이상의 태그를 나열한 형태
ul strong{ color: blue; }
※ ul, strong과 다름에 주의하자
ul strong{ color: blue; } div > strong { background: orange; }
<div> <div>Web<strong>Programming</strong></div> <ul> <li>HTML</li> <li><strong>CSS</strong></li> </ul> </div>
div의 자식 strong의 background: orange로 나타나고, ul의 자손 strong이 color:blue 적용된다.
[CSS] 부모 자식 셀렉터
자식 셀렉터
: 부모 자식 관계인 두 셀터를 '>' 기호로 조합한 형태
자손 셀렉터
: 자손 관계인 2개 이상의 태그를 나열한 형태
※ ul, strong과 다름에 주의하자
div의 자식 strong의 background: orange로 나타나고, ul의 자손 strong이 color:blue 적용된다.
자식(Child) 필터
'Front-End > CSS' 카테고리의 다른 글