Andrew's Digital Garden

CSS attributes selectors

[attr] Represents elements with an attribute name of attr.

[attr=value] Represents elements with an attribute name of attr whose value is exactly value.

[attr~=value] Represents elements with an attribute name of attr whose value is a whitespace-separated list of words, one of which is exactly value.

[attr|=value] Represents elements with an attribute name of attr whose value can be exactly value or can begin with value immediately followed by a hyphen, - (U+002D). It is often used for language subcode matches.

[attr^=value] Represents elements with an attribute name of attr whose value is prefixed (preceded) by value.

[attr$=value] Represents elements with an attribute name of attr whose value is suffixed (followed) by value.

[attr*=value] Represents elements with an attribute name of attr whose value contains at least one occurrence of value within the string.

[attr operator value i] Adding an i (or I) before the closing bracket causes the value to be compared case-insensitively (for characters within the ASCII range).

[attr operator value s] Experimental Adding an s (or S) before the closing bracket causes the value to be compared case-sensitively (for characters within the ASCII range).

https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

[[20220829104803-css-combinators]]

[[css]]

Referred in

CSS attributes selectors