프론트엔드 센트럴파크 (☞゚ヮ゚)☞

가상 클래스 선택자(Pseudo-Class Selector) - first-of-type 본문

CSS

가상 클래스 선택자(Pseudo-Class Selector) - first-of-type

자라나라나무나무나 2022. 6. 15. 20:56

See the Pen Untitled by Jeong-Dagyeong (@jeong-dagyeong) on CodePen.

 

:nth-child(2n) = :nth-child(even)

=> n의 자리에 1부터 차례대로 들어가게 되는데, 짝수가 된다.

 

:nth-child(2n-1) = :nth-child(odd)

=> n의 자리에 1부터 차례대로 들어가게 되는데, 홀수가 된다.

 

Comments