Is there a selector that can select all elements with a certain color? I want to change all text with color: #1a0dab
to color:00b0f4
.
Select all elements with a certain color?
1.5k views Asked by disgustingwaste At
3
Is there a selector that can select all elements with a certain color? I want to change all text with color: #1a0dab
to color:00b0f4
.
If the styles are defined inline, you can do this:
Demo:
There's no pure CSS way of doing this if the original styles aren't defined inline.
If you have access to JavaScript, you can do something like the following, though performance will probably be poor if your page has a lot of elements or you need to run the function frequently:
Note that you need to use the RGB representation, not the hex version, to check equality.
Here's a demo of the latter approach: