Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

부모가 CSS를 사용하는
요소인 모든

요소를 선택합니다.


요소> 요소 사용 부모 요소가 있는 요소를 선택하는 선택기.

다음 코드를 실행하여 부모가

요소인 모든

요소를 선택하려고 시도할 수 있습니다.

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         div > p {
            color: white;
            background-color: blue;
         }
      </style>
   </head>

   <body>
      <h1>Demo Website</h1>
      <h2>Fruits</h2>
      <p>Fruits are good for health.</p>
      <div>
         <p>This is demo text.</p>
      </div>
   </body>
</html>