I set the selection color in my css file, using a hexadecimal value. The thing is, Firefox and Chrome do not render the same color out of this.
Do I need to specify something to make the code render the same?
I tried using the -webkit-
and got nothing out of it. The hexadecimal value is the exact same I used for the text color. Everything, from rendering color to JS animations works perfectly with Firefox and IE, but Chrome does weird things.
On Chrome:
On Firefox:
::selection {
background: #f997f1;
}
::-webkit-selection {
background: #f997f1;
}
::-moz-selection {
background: #f997f1;
}
body {
background: lightblue;
}
p {
font-family: sans-serif;
font-size: 2em;
color: #f997f1;
}
<p>Some text to select</p>
I can reproduce it in Chrome. It looks like it is because the selection is not completely opaque. If you set a background picture, you can see it shine through. This also means that the blue background color shines through, affecting the overall color of the selection.
I cannot (yet) find what exactly causes this and how to change it. Opacity doesn't work. The color is normal rgb... Anyway, proof of the cause can be seen here.
::selection {
background: #f997f1;
}
::-webkit-selection {
background: #f997f1;
}
::-moz-selection {
background: #f997f1;
}
body {
background: lightblue;
background-image: url(https://www.google.nl/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png)
}
p {
font-family: sans-serif;
font-size: 2em;
color: #f997f1;
}
<p>Some text to select</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With