停用的输入元素样式 - Chrome和Firefox之间的差异 [英] Styling of disabled input elements - discrepancy between Chrome and Firefox

查看:97
本文介绍了停用的输入元素样式 - Chrome和Firefox之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个禁用的输入元素,我使用下面的CSS样式:

  input [disabled ='disabled'] {
color:#666;
}

此CSS在Firefox中正常工作,但Chrome会将文本颜色渲染为几种颜色太轻。如果我将颜色设置为黑色#000000 ,Chrome会将其显示为深灰色而不是黑色。



在JSFiddle中的一个例子,它会显示差异: http://jsfiddle.net/2AtGX/



我如何获得

解决方案

请检查此链接的答案:



如何我完全覆盖禁用Chrome的输入字段颜色?



简短答案:设置 -webkit-text-fill-color:black / p>

I have a disabled input element that I am styling using the following CSS:

input[disabled='disabled'] {
    color: #666;
}

This CSS works as expected in Firefox, but Chrome renders the text color several shades too light. If I set the color all the way to black #000000 Chrome renders it as a dark grey instead of black. The problem here is that the CSS produces the expected result in Firefox, but not in Chrome.

An example in JSFiddle which will showcase the discrepancy: http://jsfiddle.net/2AtGX/

How can I get this disabled input element to look the same in Firefox and Chrome?

解决方案

Please check this link for the answer:

How can I fully override Chromium disabled input field colours?

Short answer: set -webkit-text-fill-color: black

这篇关于停用的输入元素样式 - Chrome和Firefox之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆