简体   繁体   English

在不同的浏览器中显示的颜色不同

[英]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.

相关问题 为什么浏览器以不同的方式显示png中的颜色? - Why are browsers displaying the colors in a png differently? javascript在不同的浏览器中的行为有所不同 - javascript behaves differently in different browsers 角路由在不同的浏览器中表现得奇怪/不同 - Angular routing behaving strange/differently with different browsers 事件代码在不同浏览器中的行为不同 - Event Code Behaves Differently in Different Browsers JavaScript删除对象在不同的​​浏览器中的行为有所不同 - JavaScript delete objects behaves differently in different browsers 为什么这个画布在不同浏览器中的反应不同 - Why does this canvas react differently in different browsers 为什么 function 声明在不同浏览器中的处理方式不同? - Why are function declarations handled differently in different browsers? 仅使用“月、年”对日期进行排序,在不同的浏览器中表现不同 - Sorting a date with "Month, Year" only, behaving differently in different browsers 为什么FabricJS在不同的设备/浏览器上缩放模式会有所不同? - Why does FabricJS scale pattern differently on different devices/browsers? window.onerror函数在不同浏览器上的处理方式不同 - window.onerror function handled differently on different browsers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM