Attribute selector by hyphen in value
The attribute selector by hyphen in value applies a style to an element whose attribute values are separated by a hyphen.
Example
Let's find all the elements that have
text in their hyphen-separated
values and color them red:
<p class="text-main-header">text1</p>
<p class="text-content">text2</p>
<p class="test-main">text3</p>
<p class="tag-test">text4</p>
p[class|="text"] {
color: red;
}
:
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 by text in an attribute value -
an attribute selector
that searches for an element based on one of attribute values -
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