E:last-child { sRules }
有效的代碼:
p:last-child{color:#f00;}
我是一個標題
我是一個p
無效的代碼:
p:last-child{color:#f00;}
我是一個p
我是一個標題
在上述代碼中,如果我們要設置第一個li的樣式,那么代碼應該寫成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+ |