How to Set Custom Text Selection background using pure HTML CSS
03 Jun 2021 |
1124 views
Browsers by default highlight the selected text in a blue background. This can be changed by using the ::selection pseudo selector in CSS.
::-moz-selection {
color: red;
background: yellow;
}
::selection {
color: red;
background: yellow;
}
p::-moz-selection { color: red}
p::selection { color: red; }
or
p::-moz-selection,
p::selection { color: red; }
Post Comments