本文介紹了CSS nth-match 不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
nth-match 應該按照以下方式在 jsfiddle 中工作
nth-match is supposed to work in jsfiddle following way
:nth-match(even of p,h3) {text-decoration: underline;}
這應該每隔一個 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;}
演示
這篇關于CSS nth-match 不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!