Attribute selector by text
The attribute selector by text applies a style to an element whose tag attribute value contains the specified text.
Example
Let's find links that contain test
in their attributes and recolor them green:
<a href="https://test.com">link1</a>
<a href="https://code.mu">link2</a>
<a href="http://my-test.com">link3</a>
a[href*="test"] {
color: green;
}
:
See also
-
an attribute selector
that searches for an element by attribute name -
an attribute selector
that searches for an element by attribute value -
an attribute selector
that searches for an element based on the start of an attribute value -
an attribute selector
that searches for an element based on the end of an attribute value -
an attribute selector
that searches for an element based on one of attribute values -
an attribute selector
that searches for an element by a hyphen in an attribute value -
the child selector
that allows you to select elements by direct nesting -
the descendant selector,
that allows you to select an element by its parent -
the adjacent sibling selector
that allows you to select an element by its sibling -
the general sibling selector
that allows you to select elements after a given -
the universal selector
that allows you to select all elements