是否有用于< a>的CSS选择器缺少href属性的元素? [英] Is there a CSS selector for <a> elements lacking a href attribute?
本文介绍了是否有用于< a>的CSS选择器缺少href属性的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我理解css规则可以定位属性值指定的元素,例如:
I understand that css rules can target elements specified by attribute values, e.g.:
input[type="text"] {}
我可以制定一个规则,定位省略属性?例如,我可以定位缺少href的元素或不指定类型的元素吗?
Can I make a rule that targets elements which omit a certain attribute? For example, can I target elements that lack an href or elements that don't specify a type?
推荐答案
模式:
a:not([href])
input:not([type])
The attribute selector is used to select elements with the specified attribute.
:not
支持所有现代浏览器和IE9 +,如果你需要IE8或更低的支持,你是运气不好。
:not
is supported in all modern browsers and IE9+, if you need IE8 or lower support you're out of luck.
这篇关于是否有用于< a>的CSS选择器缺少href属性的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文