지정된 요소의 직계 자식을 모두 선택하려면 자식 선택기를 사용하십시오.
div > p
예시
다음 코드를 실행하여 CSS 하위 선택기를 구현할 수 있습니다.
<!DOCTYPE html>
<html>
<head>
<style>
div > p {
background-color: orange;
}
</style>
</head>
<body>
<div>
<p>Para 1 in the div.</p>
<!-- This is not a Child -->
<span><p>Para 2 in the div.</p></span>
</div>
<p>Para 3 outside the div.</p>
</body>
</html> 출력
