E:last-child { sRules }
有效的代碼:
p:last-child{color:#f00;}
我是一個(gè)標(biāo)題
我是一個(gè)p
無效的代碼:
p:last-child{color:#f00;}
我是一個(gè)p
我是一個(gè)標(biāo)題
在上述代碼中,如果我們要設(shè)置第一個(gè)li的樣式,那么代碼應(yīng)該寫成li:first-child{sRules}
,而不是ul:first-child{sRules}
。
IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|
6.0-8.0 | 2.0+ | 4.0+ | 3.1+ | 3.5+ | 3.2+ | 2.1+ | 18.0+ |
IE9.0+ |