这种风格来自CSS?

时间:2012-07-15 15:25:15

标签: css internet-explorer

我在IE9中有以下提交按钮:

My submit button

我使用的CSS如下:

.button,
input[type='button'],
input[type='submit'] {
    text-decoration: none;
    background: #eee;
    color: #89a9d1;
    padding: 4px 10px;
    font-weight: bold;

    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#fff', endColorstr='#eee')";
    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
    background: -moz-linear-gradient(top,  #fff,  #eee);
}

根据我在这个页面上的理解:http://www.colorzilla.com/gradient-editor/这应该有用......我无法弄清蓝色来自哪里。使用IE开发人员工具栏,如果我取消选择影响此元素的所有样式,它仍然会显示为我附加的图像。

有没有人对可能导致这种情况的原因有任何建议?

1 个答案:

答案 0 :(得分:3)

ColorZilla不会生成具有三位十六进制颜色值的渐变,因为它们在IE滤镜中的解释方式不同(实际上,我认为它们是无效的颜色字符串)。代码中的这种差异是导致渐变在IE中显示为蓝色的原因。

您需要将十六进制颜色展开为六位数才能正确解释:

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffffff', endColorstr='#eeeeee')";
相关问题