yuheijotaki.com

CSSスニペット

たまに使うけどそらで思い出せないもの

/* 最初 */
:first-child
:first-of-type

/_ 最後 _/
:last-child
:last-of-type

/_ X番目 _/
:nth-child(X)
:nth-of-type(X)

/_ Xの倍数 _/
:nth-child(Xn)

/_ 最後からX番目 _/
:nth-last-child(X)
:nth-last-of-type(X)

/_ X番目以降 _/
:nth-child(n+X)

/_ X番目以前 _/
:nth-child(-n+X)
:nth-of-type(-n+X)

/_ 最後からX個 _/
:nth-last-child(-n+X)
:nth-last-of-type(-n+X)

/_ 最後からX番目以前 _/
:nth-last-child(n+X)
:nth-last-of-type(n+X)

/_ 奇数 _/
:nth-child(odd)

/_ 偶数 _/
:nth-child(even)

/_ 属性 _/
input[type="text"]

参考