user2250755
user2250755

Reputation: 23

CSS ::selection, still blue in background

When you use

::selection{
    background: green;
    color: white;
}

some parts of the site still have the blue when you select everything, is there anyway to fix this and make it so there is only a green background and no blue what so ever?

Upvotes: 2

Views: 707

Answers (2)

Santiago Baigorria
Santiago Baigorria

Reputation: 696

Those part happen in every site. It's normal. Take a look at mine: santz.net

I haave the same problem but it's a browser bug. Not a coding problem.

The code is okay. However, you might also need this for Mozilla

::-moz-selection {
    background-color: green;
    color: #fff;
}

::selection {
    background-color: green;
    color: #fff;
}

Upvotes: 2

Mooseman
Mooseman

Reputation: 18891

No problems here with the code you gave. Fiddle: http://jsfiddle.net/3fWYZ/1/

HTML:

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

CSS:

::selection{
    background:green;
    color :white;
}

Upvotes: 0

Related Questions