本文介紹了CSS nth-match 不起作用的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
nth-match 應(yīng)該按照以下方式在 jsfiddle 中工作
nth-match is supposed to work in jsfiddle following way
:nth-match(even of p,h3) {text-decoration: underline;}
這應(yīng)該每隔一個(gè) p
和 h3
元素下劃線.但是,它不起作用 - 無論是在 FF 還是在 Chrome 中:
this should underline every second p
and h3
elements. But, it doesn't work - neither in FF nor in Chrome:
http://jsfiddle.net/VUKQS/
問題出在哪里?
推薦答案
CSS4選擇器目前沒有太多瀏覽器支持,看這里.
CSS4 selectors don't have much browser support at the moment, see here.
您可以使用 nth-of-type
,這是一種具有更好瀏覽器支持的 CSS3 選擇器 (看這里):
You could use nth-of-type
, a CSS3 selector that has greater browser support (see here):
p:nth-of-type(even) {text-decoration: underline;}
演示
這篇關(guān)于CSS nth-match 不起作用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!