【发布时间】:2018-03-28 21:37:14
【问题描述】:
很遗憾,我在处理三角形部分时遇到了问题。底层与顶层不匹配。 我正在为三角形使用边框技术。底层应该离顶层4px。
JSFiddle 也在底部。
<a class="btn" href="#"><span>Button text here</span></a>
scss:
.btn {
display: inline-block;
vertical-align: middle;
position: relative;
background: #EAC118;
padding: 0 30px;
line-height: 55px;
span {
display: block;
&::after {
content: '';
position: absolute;
top: 0;
right: -16px;
width: 0;
height: 0;
border-style: solid;
border-width: 27px 0 28px 16px;
border-color: transparent transparent transparent #EAC118;
}
}
&::before {
content: '';
position: absolute;
left: 4px;
bottom: -4px;
right: -6px;
height: 100%;
z-index: -1;
background: #ff0000;
}
&::after {
content: '';
position: absolute;
bottom: 0;
right: -22px;
width: 0;
height: 0;
z-index: -1;
border-style: solid;
border-width: 24px 0px 28px 16px;
border-color: transparent transparent transparent #ff0000;
}
}
【问题讨论】:
标签: css css-transforms