CSS:为什么在Chrome和Firefox中颜色代码#999的阴影不同?

Jey*_*ari 2 html css firefox google-chrome

我需要如下更改HTML5输入占位符样式。

input[type="text"]#myInput::placeholder {
font-size: 13px;
  font-family: helvetica;
  color: #999;
  font-weight: 400;
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码片段中,我使用了#999色阴影,但是在chrome和IE中看起来很像,而在Firefox中看起来很淡。

我的示例代码在这里:https : //codepen.io/JGSpark/pen/MMQxER?&editable=true

请先在Chrome中浏览,然后在Firefox中尝试。

PS:我使用的是Chrome 75 +,Firefox 67 +,IE11

谁能帮助我在所有浏览器中使外观相似?

小智 11

默认情况下,版本19及更高版本中的Firefox对占位符文本应用40%(0.4)的不透明度。只需添加不透明度即可:1;

input:-moz-placeholder,
input::-moz-placeholder {
    opacity: 1 !important;
}
Run Code Online (Sandbox Code Playgroud)