【发布时间】:2014-02-03 22:27:31
【问题描述】:
我正在使用transform: skew 使用:before 和:after tags 在我的横幅图像上创建向下箭头的效果。结果应如下所示:
但是,在 IE 9-11 中似乎存在舍入问题。在某些高度,背景图像中有一个像素显示在倾斜块下方,结果如下:
在我的例子中,横幅是窗口总高度的百分比。这是一些应该能够重现问题的示例代码:
HTML
<div id="main">
<div id="banner"></div>
<section>
<h1>...</h1>
<p>...</p>
</section>
</div>
CSS
#banner {
position: relative;
background-color: green;
width: 100%;
height: 75%;
overflow: hidden;
}
#banner:before,
#banner:after {
content: '';
display: block;
position: absolute;
bottom: 0;
width: 50%;
height: 1.5em;
background-color: #FFFFF9;
transform: skew(45deg);
transform-origin: right bottom;
}
#banner:after {
right: 0;
transform: skew(-45deg);
transform-origin: left bottom;
}
body {
background-color: #333;
position: absolute;
width: 100%;
height: 100%;
}
#main {
max-width: 40em;
margin: 0 auto;
background-color: #FFFFF9;
position: relative;
height: 100%;
}
section {
padding: 0 1em 5em;
background-color: #FFFFF9;
}
这里是working example。
【问题讨论】:
标签: css internet-explorer transform