未满十八18勿进黄网站|美国victoryday高清sort|江西迎来气温大跳水|一区二区在线免费观看|自偷自拍综合精品|五个黑人玩一女4P|WRITEAS串珠

????????? CSS3中的nth-of-type偽元素選擇前幾個或后幾個 ?????????

CSS-CSS3

CSS3中的nth-of-type偽元素選擇前幾個或后幾個。nth使用時應該注意幾點。(n)中的n如果有運算,n必須放在前面,n從0開始遞增,()內運算結果大于元素個數(shù),運算自動停止。

選擇1~9<li>如下:

li:nth-of-type(-n+9) {background:red}

選擇9~最后<li>如下:

li:nth-of-type(n+9) {background:red}

選擇倒數(shù)2個<li>如下:

li:nth-last-of-type(-n+2) {background:red}

nth-child也是同樣用法:

li:nth-child(-n+9) {background:red}             //1~9個
li:nth-child(n+9) {background:red}              //9~最后
li:nth-last-of-type(-n+2) {background:red}      //倒數(shù)2個

這類應用在平時WEB開發(fā)經(jīng)常用到。