CSS pattern matching
Hey everyone, I'm curious if there's a way to apply pattern matching when selecting elements using CSS. In particular, I want to target anchor elements that contain a particular word in their href attribute, for example:
This doesn't work, but the idea is that if the word "keyword" appears in the attribute "href" it would select this element. Is this possible, or is there something equivalent to this?
2 Replies
Pff, as usual as soon as I ask online I find the answer right away 😫
MDN Web Docs
Attribute selectors - CSS: Cascading Style Sheets | MDN
The CSS attribute selector matches elements based on the element having a given attribute explicitly set, with options for defining an attribute value or substring value match.