CSS :first-of-type 선택기를 사용하여 부모의 첫 번째
요소인 모든
요소의 스타일을 CSS로 지정하세요.
예시
다음 코드를 실행하여 :first-of-type 선택기를 구현할 수 있습니다.
<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type {
background: orange;
}
</style>
</head>
<body>
<p>This is demo text1.</p>
<p>This is demo text2.</p>
</body>
</html>