0

I'm trying to use a CSS selector to target all elements that have a style attribute that contains a background image style

example:

*[style^="background-image"] {
        color: yellow;
    }

<div  style="background-image: url('https://x.jpg')">hi</div>

This example will work only if the first attribute is the "background-image".

it will not work for this example:

<div  style="height:100px;background-image: url('https://x.jpg')">hi</div>

How can I get my selector to work on any element that has a background image style?

Thanks

אVי
  • 1,913
  • 6
  • 22
  • 35

0 Answers0