【发布时间】:2014-10-12 21:29:08
【问题描述】:
在玩用 CSS 制作的条纹渐变时,我发现 IE 有一个奇怪的行为,在减少 background-size 属性中的高度值后条纹变得不可见。
此行为仅在 IE 中:Chrome 和 Firefox 按预期工作。
代码如下:
HTML
<body>
<div class="stripes all"> </div>
<div class="stripes no_ie"> </div>
</body>
CSS
.stripes {
height: 500px;
background-image: linear-gradient(red 1px, transparent 1px);
background-attachment: scroll;
background-position: 0 -10px;
background-color: white;
}
.all {
background-size: 100% 98px; /* Will show stripes in IE */
}
.no_ie {
background-size: 100% 97px; /* Will not show anything in IE */
}
这是演示: http://jsbin.com/jipehipobele/1/edit
如果可能的话,有人可以向我解释为什么会发生这种情况以及如何规避它吗?
【问题讨论】:
标签: css internet-explorer linear-gradients background-size