자식 요소 선택자
1. 자식 요소 선택자
종류
설명
:first-child
첫 번째 자식 요소를 선택합니다.
:first-of-type
첫 번째 자식 요소와 일치하는 유형을 선택합니다.
:last-child
마지막 번째 자식 요소를 선택합니다.
:last-of-type
마지막 번째 자식 요소와 일치하는 유형을 선택합니다.
:nth-child(index)
index 번째에 있는 자식 요소를 선택합니다.
:nth-last-child(index)
index 번째에 있는 마지막 자식 요소를 선택합니다.
:nth-of-type(index)
index 번째에 있는 유형의 자식 요소를 선택합니다.
:nth-last-of-child(index)
index 번째에 있는 마지막 유형의 자식 요소를 선택합니다.
:only-child
자식 요소가 오직 하나인 요소를 선택합니다.
:only-of-type()
자식 요소 중 오직 하나 유형인 요소를 선택합니다.
Last updated
Was this helpful?