变换倾斜导致 IE 中的 0.5px 垂直偏移
Transform skew causes 0.5px vertical shift in IE
我正在制作右侧倾斜的形状。
代码如下:
h2 {
display: inline-block;
position: relative;
text-transform: uppercase;
background: #2b4450;
color: white;
font: bold 16.67px'Raleway', sans-serif;
padding: 0 35px;
height: 35px;
line-height: 35px;
cursor: pointer;
}
h2:before {
content: '';
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 34px;
transform-origin: right top;
transform: skew(30deg) translate3d(0, 0, 0);
background: inherit;
}
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
在 Chrome 和 Firefox 中看起来不错,但在 IE 中不行。在 IE 中,伪元素向上移动约 0.5px,有时向下移动 0.5px,这就是它的外观:
有什么建议吗?
如果边框是一个选项:https://jsfiddle.net/3nmha5sf/9/
HTML
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
SCSS
h2 {
display: inline-block;
position: relative;
text-transform: uppercase;
background: #2b4450;
color: white;
font: bold 16.67px 'Raleway', sans-serif;
padding: 0 35px;
height: 35px;
line-height: 35px;
cursor: pointer;
&:after {
content: '';
position: absolute;
right: -20px;
bottom: 0;
width: 0;
background: none;
height: 0;
border: solid transparent;
border-bottom-color: #2b4450;
border-width: 0 20px 35px;
}
}
我正在制作右侧倾斜的形状。
代码如下:
h2 {
display: inline-block;
position: relative;
text-transform: uppercase;
background: #2b4450;
color: white;
font: bold 16.67px'Raleway', sans-serif;
padding: 0 35px;
height: 35px;
line-height: 35px;
cursor: pointer;
}
h2:before {
content: '';
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 34px;
transform-origin: right top;
transform: skew(30deg) translate3d(0, 0, 0);
background: inherit;
}
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
在 Chrome 和 Firefox 中看起来不错,但在 IE 中不行。在 IE 中,伪元素向上移动约 0.5px,有时向下移动 0.5px,这就是它的外观:
有什么建议吗?
如果边框是一个选项:https://jsfiddle.net/3nmha5sf/9/
HTML
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
<br/>
<br/>
<h2>ALL CAMPAIGNS</h2>
SCSS
h2 {
display: inline-block;
position: relative;
text-transform: uppercase;
background: #2b4450;
color: white;
font: bold 16.67px 'Raleway', sans-serif;
padding: 0 35px;
height: 35px;
line-height: 35px;
cursor: pointer;
&:after {
content: '';
position: absolute;
right: -20px;
bottom: 0;
width: 0;
background: none;
height: 0;
border: solid transparent;
border-bottom-color: #2b4450;
border-width: 0 20px 35px;
}
}