是否存在适用于非空属性的CSS选择器?如果属性不存在,则使用:not([Data-Attribute=''])
匹配。用于非空属性的CSS属性选择器
我在寻找类似[Data-Attribute!='']
的东西。
是否存在适用于非空属性的CSS选择器?如果属性不存在,则使用:not([Data-Attribute=''])
匹配。用于非空属性的CSS属性选择器
我在寻找类似[Data-Attribute!='']
的东西。
试试这个
<style>
[Data-Attribute]:not([Data-Attribute=""])
{
background-color: Red;
}
</style>
这不会是类似''如果你谈论的jQuery选择,因为jQuery选择等同于'[数据属性=“”!]:不([Data-Attribute =''])'并且如果该属性没有被指定,则匹配。 – BoltClock
[Select element where attribute is non-empty]可能重复(http://stackoverflow.com/questions/16429220/select-elements-where-attribute-is-non-empty) – user