so woon!

[결합자] 자손 결합자 (Descendant Combinator) 본문

CSS/개념정리

[결합자] 자손 결합자 (Descendant Combinator)

xowoony 2022. 9. 6. 22:09

학습일 : 2022. 09. 05


자손 결합자 (Descendant Combinator)
자손 결합자(Descendant Combinator)는 어떠한 부모 선택자에 대한 자손을 선택하기 위해 사용하는 결합자이다.
다음과 같이 작성한다. ("는 없는 것으로 한다.)

"어떠한 부모 선택자" "자손 선택자" {
      "속성" : "속성 값";
      "속성" : "속성 값";
      "속성" : "속성 값";
  }

 

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <title>자손 결합자</title>
    <style>
        div section {
            color: red;
        }
    </style>
</head>
<body>
    <div>
        <aside>
            <nav>
                <section>Hi!</section>❤
            </nav>
        </aside>
    </div>
    <section>내가 빨간색임</section>❤
</body>
</html>

===============실행결과================

Comments