1

Is there a way to select an element that doesn't have a certain CSS property applied inline (independently of the value)?

.element:not([background-color^="rgb"]){}

.element:[background-color=""]{}
Alvaro
  • 9,247
  • 8
  • 49
  • 76

1 Answers1

2

The attribute is the style not the CSS property (background-color in this case).

-Using the CSS3 [attribute^=value] Selector, the value begins with the word ("background-color"):

.element:not([style^="background-color"]){}

-Using the CSS [attribute~="value"] Selector, the value contains a specified word ("background-color:"), in any part of the value, but the whole word:

.element:not([style~="background-color:"]){}

-Using the CSS [attribute|="value"] Selector, the value has to be a whole word, either alone, like class="top", or followed by a hyphen( - ):

.element:not([style|="background"]){}

-Using the CSS [attribute*="value"] Selector, the value contains a specified value (letters), in any part of it:

.element:not([style*="background"]){}
Alvaro
  • 9,247
  • 8
  • 49
  • 76