CSS text selection?

I am trying to change the selection of text on my HTML page. I want to change the hex value in css for the selected text whenever I select any text from the paragraph. How can I do this in CSS?

For example, as shown in this image below, it changes color to blue.

alt text

Can this be done? if so how? any field in CSS?

0
source share
3 answers

As a complement to what Reinies wrote, and for future issues: you can get FireBug and right-click on an element and select "Inspect Element". This will give you the exact code you need.

+1
source

, . . CSS > .

+3
    <style>

    ::-moz-selection {
    color:white;
    background:#3A75AF ;
    }

    ::selection {
    color:white;
    background:#3A75AF ;
    }

    </style>

. . IE.

0
source

Source: https://habr.com/ru/post/1748860/


All Articles