Select elements where attribute is non-empty

前端 未结 3 546
猫巷女王i
猫巷女王i 2020-12-17 09:14

Suppose I have the following:

Unknown
Known 123

Is there a way

3条回答
  •  时光说笑
    2020-12-17 09:56

    /* Normal styles */
    [data-pid] {}
    
    /* Differences */
    [data-pid=""] {}
    

    jsFiddle.

    This will have much better browser support. Instead of selecting the ones you want, style all of them and then place the differences in the second selector.

提交回复
热议问题