Is there a CSS selector for elements lacking an attribute?

后端 未结 4 519
一整个雨季
一整个雨季 2021-02-04 23:44

I understand that css rules can target elements specified by attribute values, e.g.:

input[type=\"text\"] {}

Can I make a rule that targets ele

4条回答
  •  眼角桃花
    2021-02-04 23:54

    You can follow this pattern:

    a:not([href])
    input:not([type])
    

    The attribute selector is used to select elements with the specified attribute.

    :not is supported in all modern browsers and IE9+, if you need IE8 or lower support you're out of luck.

提交回复
热议问题