[英]Colors shown differently in different browsers
I have a input text box of #c7e296
color and when in focus then color changes to #668933
but when I test this in different browser they show some different colors on focus. 我有一个
#c7e296
颜色的输入文本框,当焦点对#668933
颜色变为#668933
但是当我在不同的浏览器中对其进行测试时,它们会在焦点上显示一些不同的颜色。
Can someone explain why? 有人可以解释为什么吗?
Below is my code, 下面是我的代码,
.after input[type="text"]:focus {
border: 2px solid #668933;
}
.before input[type="text"] {
border: 2px solid #c7e296;
color: #000000;
font-size: 1em;
}
Some browsers (notably Safari) do a highlight around a focussed input field themselves. 一些浏览器(尤其是Safari)本身会在突出显示的输入字段周围突出显示。 So if you set a border, and the browser does its highlight, the colors can bleed together.
因此,如果设置了边框, 并且浏览器将其突出显示,则颜色可能会一起渗出。
You can disable that by putting outline-width: 0
on your :focus
rule(s): 您可以通过在您的
:focus
规则上放置outline-width: 0
来禁用它:
.after input[type="text"]:focus {
border: 2px solid #668933;
outline-width: 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.