CSS Selection Color Behaving Strangely on Chrome

CSS selection color behaving strangely on Chrome

Possibly to prevent exactly what you are trying to do, it seems like Chrome will change the opacity of the background color of the selection if it's 1. You can cheat this by setting the opacity very close to 1 like (background-color: rgba(0,0,0,.99).

http://jsfiddle.net/ExplosionPIlls/a3gfR/5/

CSS3 ::selection behaves differently in FF & Chrome

For some reason Chrome forces it to be semi-transparent. However, you can get around this by setting the background using rgba. I have set the alpha value to be just 0.01 less than 1. Live example: http://jsfiddle.net/tw16/m8End/

p::-moz-selection {
background:rgba(255, 255, 125, 0.99);
color:#032764;
}
p::-webkit-selection {
background:rgba(255, 255, 125, 0.99);
color:#032764;
}
p::selection {
background:rgba(255, 255, 125, 0.99);
color:#032764;
}

Issue with background color and Google Chrome

Never heard of it. Try:

html, body {
width: 100%;
height: 100%;
background-color: #000;
color: #fff;
font-family: ...;
}


Related Topics



Leave a reply



Submit