html - Safari 浏览器的背景色保持白色

标签 html css

我必须为只读输入字段提供背景颜色 (#eeeeee)。

.form-control[disabled], 
.form-control[readonly],
fieldset[disabled] .form-control {
    cursor: not-allowed;
    background-color: #eeeeee;
    opacity: 1;
}
<input id="tagNumber" name="j_username" class="form-control" tabindex="1" data-enhance="false" data-role="none" value="" maxlength="241" autocomplete="off" readonly="" type="text">

这在除 safari 浏览器之外的所有浏览器中都可以正常工作。 在 safari 中,背景颜色保持为白色。 我尝试通过 jquery 提供背景颜色,并在运行时向元素添加特定类。似乎没有任何效果。请帮忙。

它在非 Safari 浏览器上的外观:

enter image description here

它在 safari 浏览器上的外观:

enter image description here

最佳答案

试试这个可能有用

# @media screen and (-webkit-min-device-pixel-ratio:0)
{
#safari { background-color:#eeeeee }
}

或者在您的背景颜色中尝试 rgb,例如:

rgb(238, 238, 238) #eeeeee

background-color:rgb(238, 238, 238);

关于html - Safari 浏览器的背景色保持白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40084508/

相关文章:

html - 为 Hover 修改 Dropdown-Toggle

html - 底部导航栏空白

css - Vuetify 包 css 覆盖应用程序的 css

html - Bootstrap 不允许我将自己的尺寸添加到 div

html - 如何将 css 添加到层次结构中第 4 级的特定 div?

html - 在 Twitter Bootstrap 中合并两个 CSS 框

javascript - Angular2 [ngClass] 条件引导样式被切断

html - 使网站在所有设备和屏幕尺寸上可用并保持一致的最佳实践是什么?

javascript - 测试元素是否可以包含文本

点击时jQuery动画背景颜色