Is it possible to have a CSS selector based on a CSS property (and its value)?
No. There's no way to do this with css. You need to use scripting language.
But if you have defined style in your html like the following then this would be possible like:
div[style="overflow:auto;"]{
background-color: #f00;
}
<div style="overflow:auto;">overflow is auto</div>
Note that style="overflow:auto;"
will match divs which has exact that CSS (string). If you want to select divs that contains overflow:auto
along with some other css, you can use *
selector.
div[style*="overflow:auto;"]{
background-color: #f00;
}