ul li:first-child{ } 第一個
ul li:last-child{ } 最后一個
ul li:nth-child(4){ } 指定第幾個,4就是代表第四個
ul li:nth-child(2n+1){background:red;}/*匹配第1、第3、第5、…個li*/
ul li:nth-child(odd){background:red;} 基數
ul li:nth-child(even){background:red;} 偶數
ul li:first-child{ } 第一個
ul li:last-child{ } 最后一個
ul li:nth-child(4){ } 指定第幾個,4就是代表第四個
ul li:nth-child(2n+1){background:red;}/*匹配第1、第3、第5、…個li*/
ul li:nth-child(odd){background:red;} 基數
ul li:nth-child(even){background:red;} 偶數
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。