# 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-select` property
  that disables text selection
- the `pointer-events` property
  that removes a response to the mouse

← →
↑
en ru