Here’s how to change the text selection color using CSS.
1. Suppose this is the text you want to change the color on selection.
<h1>Select this text</h1>
2. You can either target the single element, h1 in this case, h1::selection. Or apply it to all the elements like below.
::selection {
background-color: teal;
color: #fff;
}
Output:
Select this text
If you have any doubts or stuck somewhere, you can reach out through Coding Yaar's Discord server.