Change color of selection

后端 未结 3 1880
不思量自难忘°
不思量自难忘° 2020-12-10 16:15

When you select text in browser, most often background behind text being selected changes color to blue. How to change this color to another?

3条回答
  •  星月不相逢
    2020-12-10 16:43

    Take a look at this article...

    http://css-tricks.com/490-overriding-the-default-text-selection-color-with-css/

    ... so something like this:

    p.moz::-moz-selection {
        background:#cc0000;
        color:#fff;
    }
    
    p.webkit::-webkit-selection {
        background:#cc0000;
        color:#fff;
    }
    
    p.normal::selection {
        background:#cc0000;
        color:#fff;
    }
    

    I hope this helps.
    Hristo

提交回复
热议问题