In most browsers the actual displayed background color doesn't match the configured background color.
In the example below the configured background color is black (#000000). In Internet Explorer and Firefox the displayed background color is really black (#000000), what's perfect. However, in Google Chrome, Microsoft Edge, Opera and Safari the displayed background color is '#333333'. In Safari the background color of the selected 'Input Text' is even blue.
Is there really no way to force all browsers to display exactly the configured background color?
Note: The text color is displayed correctly in all browsers.
And here's my code:
<html>
<head>
<style type = "text/css">
::selection {
color: #ffffff;
background-color: #000000;
}
::-moz-selection {
color: #ffffff;
background-color: #000000;
}
</style>
</head>
<body>
Normal Text<p>
<input type = "text" value = "Input Text">
</body>
</html>
Here's a new code snippet where my "problem" is more visible:
<html>
<head>
<style type = "text/css">
::selection {
color: #000000;
background-color: #ffffff;
}
::-moz-selection {
color: #000000;
background-color: #ffffff;
}
</style>
</head>
<body>
<input type = "text" style = "color: #ffffff; background-color: #000000" value = "Input Text">
</body>
</html>
If the background is black, it's more obvious that the selection color is gray (#989898) instead of white (#ffffff) as coded.
How can I force Google Chrome, Microsoft Edge, Opera and Safari to display the selection in white instead of gray?