Safari浏览器的背景颜色保持白色

时间:2016-10-17 10:51:54

标签: 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提供背景颜色,并在运行时向元素添加特定的类。似乎没什么用。 Plz帮助。

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

enter image description here

它在safari浏览器上的外观如何:

enter image description here

1 个答案:

答案 0 :(得分: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);
相关问题