【问题标题】:Background color remains white for safari browserSafari 浏览器的背景颜色保持白色
【发布时间】:2016-10-17 19:30:19
【问题描述】:

我必须为只读输入字段提供背景颜色 (#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 浏览器上的外观:

它在 Safari 浏览器上的外观:

【问题讨论】:

  • 它在我的灰色背景的 mac safari 中运行良好...您使用的是哪个操作系统?或者可能是你的 css 会与其他 css 冲突..
  • 在 iphone 5 和 iphone 6 中不适合我
  • 尝试添加一行代码:background-color: -webkit-#eeeeee;
  • 顶部的内框阴影告诉我-webkit-appearance: none; 会修复它。

标签: html css


【解决方案1】:

试试这个可能有用

# @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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 2012-06-19
    • 1970-01-01
    • 2020-05-31
    • 2016-11-24
    • 1970-01-01
    • 2012-05-25
    相关资源
    最近更新 更多