내가 가장 좋아하는 CSS 선택기 중 하나입니다.
친자관계나 질서를 확실히 알면 선택하기가 더 쉬울 것 같다는 생각이 들었습니다.
펜 참조 무제 by 노수빈(@subinno) 에 코드펜.
| /* #컨테이너 div:first-child{  파란색; } #컨테이너 div:nth-child(8){  /* #container div:nth-child(even) {  #컨테이너 div:nth-child(2n) {  /* #container div:nth-child(odd) {  #container div:nth-child(2n+1) {  #container p:nter type(1) {  #container p:nter type(4) {  #container p:n-last-of-type(3) {   | 
:nth-child(n) : n번째 자식을 선택합니다. 정수, 홀수, 짝수, 시퀀스 등을 사용할 수 있습니다. A:nth-of-type(n): A 자식 중에서 n번째 자식을 선택합니다. #container div:첫 번째 자식   #container div:nth-child(짝수) #container div:nth-child(odd) / (2n+1) 홀수 p:nter 유형(1) p:n-마지막 유형(3)  | 

