当鼠标悬停在按钮上时,白色背景颜色的悬停效果会在按钮外转换,溢出属性不起作用。 overflow: hidden;
应在按钮内显示效果。
.button {
flex: 0 0 auto;
height: 40px;
width: 230px;
margin: 10px;
padding: 5px;
padding-right: 15px;
padding-left: 15px;
border-radius: 5px;
background: #ffbb11;
text-align: center;
color: #000000;
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-around;
overflow: hidden;
}
.button::before,
.button::after {
background: #fff;
content: '';
position: absolute;
z-index: -1;
}
.button:hover {
color: #ffbb11;
}
.button::after {
height: 70px;
left: -8%;
top: 5;
transform: skew(50deg);
transition-duration: 0.6s;
transform-origin: top;
width: 0;
}
.button:hover:after {
height: 60px;
width: 325px;
}
.iconBtn{
max-height: 85%;
max-width: 85%;
}
<div class="services">
<a href="https://apply.sorensonvrs.com/secured_contact_support"><div class="button"><img src="http://beacon.svrs.com/asset/imgs/icon-techsup2.png" class="iconBtn">
<div class="serv-name">TECHNICAL SUPPORT</div></div></a>
</div>
<div class="services">
<a href="http://www.sorensonvrs.com/contact_customer_service"><div class="button"><img src="http://beacon.svrs.com/asset/imgs/icon-custserv2.png" class="iconBtn">
<div class="serv-name">CUSTOMER SERVICE</div></div></a>
</div>
请参阅 JSFIDDLE
答案 0 :(得分:1)
你错过了一些code
。检查fiddle。您应该在position: relative;
button
中添加class
。希望这会有所帮助!
答案 1 :(得分:0)
我真的不明白你要找的最终产品,但你可以试试这个
.button::before,
.button::after {
background: #fff;
content: '';
position: relative;
}
相对而不是绝对