S
S
Sergey Rakipov2020-05-06 12:44:58
css
Sergey Rakipov, 2020-05-06 12:44:58

Why isn't the ::selection pseudo-element applied to the body?

With div and p everything works, but main and so on. No

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ankhena, 2020-05-06
@sergei2210

Why isn't the ::selection pseudo-element applied to the body?

This is not true.
It applies to body body::selection{}and works. But it is not inherited.

https://jsfiddle.net/og2d4mwk/
If you need to apply to all elements, then write like this
::selection {
  background: #f00;
}

or specify specific tags/classes.
And don't forget the autoprefixer.

O
Oleg, 2020-05-06
@politon

Can be applied to the entire document

::selection {
  color: red;
  background: yellow;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question