selection pseudo-element
The selection pseudo-element allows
you to set a color and background of
a selected text.
Syntax
selector::selection {
}
Example
Select the text and you will see that it will be red on a black background:
<div id="elem">
Lorem ipsum dolor sit amet.
</div>
#elem::selection {
color: red;
background-color: black;
}
:
See also
-
the
user-selectproperty
that disables text selection -
the
pointer-eventsproperty
that removes a response to the mouse