我在使用 CSS 三角形时遇到了一个非常具体的问题:
我创建了可以在桌面浏览器(ie9+、ff、chrome、safari)和纵向模式下的 iPhone 上完美运行的按钮......这个问题存在于 iPad(视网膜和非视网膜)以及横向 iPhone 上。该按钮在主容器和我已经到位的 css 三角形之间呈现一条线。
这是imgur上的截图:
这是我正在使用的代码:
HTML:
<a href="#" class="cta-watch large"><span>BUTTON SHAPE</span></a>
CSS(可能包含一些不相关的样式,因为这是从较大的文件中粘贴的):
.cta-watch {
display: inline-block;
position: relative;
padding: 0 10px;
background-color: #91a1a8;
border-collapse: collapse;
color: white;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-style: normal;
letter-spacing: 2px;
font-weight: 400;
font-size: 30px;
letter-spacing: 2px;
text-transform: uppercase;
line-height: 40px;
text-decoration: none;
transform: rotate(360deg);
}
.cta-watch.large {
display: inline-block;
position: relative;
width: 34px;
height: 32px;
}
.cta-watch.large:hover {
text-decoration: none;
}
.cta-watch.large.arrow-left::after, .cta-watch.large.arrow-right::after {
border-left: none;
border-right: none;
}
.cta-watch.large span {
display: inline-block;
width: 0;
height: 0;
text-indent: -99999px;
}
.cta-watch.large span:before {
width: 0;
height: 0;
content: '';
border-color: transparent transparent #91a1a8 transparent;
border-width: 0 27px 14px 27px;
border-style: solid;
position: absolute;
top: -14px;
left: 0;
}
.cta-watch.large span:after {
width: 0;
height: 0;
content: '';
border-color: #91a1a8 transparent transparent transparent;
border-width: 14px 27px 0 27px;
border-style: solid;
position: absolute;
bottom: -14px;
left: 0;
}
.cta-watch.large:before {
display: block;
width: 100%;
height: 0;
content: '\25BA';
color: white;
font-family: arial, "Helvetica Neue", Helvetica, sans-serif;
margin-left: 3px;
font-size: 22px;
line-height: 34px;
text-align: center;
}
JSBin 在此处显示代码演示:http: //jsbin.com/ocaGeja/1
任何帮助将不胜感激 - 谢谢!