亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

:n?? ???

? ???? ?? ??? ???? ??? ???? ???? ? ????.

:fist-child
:last-child
:nth-child()
:nth-last-child()
:nth-of-type()
:nth-last-of-type()
:first-of-type
:last-of-type
:only-child
:only-of-type
:empty

:first-child? ??? ? ?? ?? ??? ?????. :last-child? ??? ??? ?? ??? ?????. :nth -child()? ?? ??? ?????. ??? ?? ?? ??; :nth-last-child()? ? ??? ??? ?? ???? ???? ??? ?? ??? ?? ?? ??? ?????. ;:nth-of-type()? ??? ??? ?????. nth-last-of-type()? ??? ???? ???? ??? ??? ?????. :first-of-type? ?? ?? ??? ? ?? ??? ?????. ?? ??? ??? ??? ??? ?? ?????. :only-child? ?? ??? ??? ??? ??? ?????. :only-of-type? ?? ??? ??? ??? ??? ?? ?????. ?? ??; :empty? ??? ??? ??? ????.

1, :first-child

.demo li:first-child {background: green; border: 1px dotted blue;}.demo li.first {background: green; border: 1px dotted blue;}

css3-selector-nth1.png

2, :last-child

.demo li:last-child {background: green; border: 2px dotted blue;}
.demo li.last {background: green; border: 2px dotted blue;}

css3-selector-nth2.png

3, :nth-child()

:nth-child(length);/*參數(shù)是具體數(shù)字*/
:nth-child(n);/*參數(shù)是n,n從0開始計算*/
:nth-child(n*length)/*n的倍數(shù)選擇,n從0開始算*/
:nth-child(n+length);/*選擇大于length后面的元素*/
:nth-child(-n+length)/*選擇小于length前面的元素*/
:nth-child(n*length+1);/*表示隔幾選一*/
//上面length為整數(shù)
.demo li:nth-child(3) {background: lime;}

css3-selector-nth3.png

?? ??? ???? ?? ?? ??? ? ????. ?, li:nth-child(-3)? ??? ??????.


:nth-child(2n), ? ??? ?? ??? ?????. n? ?? 2?? ??? ? ????. ?? "2"? ??? ??? ?? ? ????. ?? li:nth-child( 2n) {??: ??;} .demo

li:nth-child(even) {background: lime;}

:nth-child(-n+5)? ?????. ? ????
n=0 --> -n+5=5 --> 5?? li? ?????.
n=1 - -》 -n+5=4 --》 4?? li? ???????
n=2 --》 -n+5=3 --》 3?? li? ???????
n=3 --- 》 -n+5= 2 --》 ? ?? li
n=4? ??????? --》 -n+5=1 --》 ? ?? li
n=5? ??????? --》 -n+5= 0--》??? ???? ?????

4, :nth-last-child()

.demo li:nth-last-child(4) {background: lime;}

css3-selector-nth10.png

5, :nth-of-type

:nth-of-type? :nth-child? ?????. ???? ??? ??? ????. ???? ??? ??

6. :nth-last-of-type

?? ?? ?? ? ???? ?? :nth-last-child ? ???? ?????. ?? ??.

7. :first-of-type ? :last-of-type

: ? ?? ???: first-of-type ? :last-of-type? :first-child ? :last-child? ?????. ???? ?? ??? ????? ????.

8, :only-child ? :only-of-type

":only-child"? ??? ?? ??? ??? ?? ???? ?????.

9, :????

:empty? ??? ?? ??? ???? ? ?????. ??? ??? ?? ??? ?????. ?? ?? ??? ? ??? ? ? ??? ???? ?? ??? ?? ????. ?????



???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://ipnx.cn/" /> <title>php中文網(wǎng)</title> <style type="text/css"> li:first-child{ color:green; } </style> </head> <body> <ul> <li>html專區(qū)</li> <li>Div+css專區(qū)</li> <li>Jquery專區(qū)</li> <li>Javascript專區(qū)</li> </ul> </body> </html>