实际效果由于不方便截.gif图:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>光反射按钮效果</title>
<style>
*{
margin: 0;
padding: 0;
}
html,body{
box-sizing: border-box;
height: 100%;
width: 100%;
}
.buttons{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
text-align: center;
width: 100%;
margin: 0 auto;
}
.container{
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
padding: 40px 0px;
width: 240px;
}
h1{
text-align: left;
color: #333;
letter-spacing: 0.05em;
margin: 0 0 0 .4em;
font-size: 1em;
}
.btn{
letter-spacing: .1em;
cursor: pointer;
font-size: 14px;
font-weight: 400;
line-height: 45px;
max-width: 160px;
position: relative;
text-decoration: none;
text-transform: uppercase;
width: 100%;
}
.btn:hover{
text-decoration: none;
}
.effect{
color: #fff;
border: 4px solid #000;
box-shadow: 0px 0px 0px 1px #000 inset;
background: #000;
overflow: hidden;
position: relative;
transition: all 0.3s ease-in-out;
}
.effect:hover{
border: 4px solid #666;
background-color: #fff;
box-shadow: 0px 0px 0px 4px #eee inset;
}
.effect span{
transition: all .2s ease-out;
z-index: 2;
}
.effect:hover span{
letter-spacing: .13em;
color: #333;
}
.effect::after{
background: #fff;
border: 0px solid #000;
content: "";
height: 155px;
left: -75px;
opacity: .8;
position: absolute;
top: -50px;
transform: rotate(35deg);
width: 50px;
transition: all 1s cubic-bezier(0.075,0.82,0.165,1);
z-index: 1;
}
.effect:hover::after{
background: #fff;
border: 20px solid #000;
opacity: 0;
left: 120%;
transform: rotate(40deg);
}
</style>
</head>
<body>
<div>
<div class="buttons">
<div class="container">
<h1>光反射</h1>
<a href="#" class="btn effect"><span>TEXT</span></a>
</div>
</div>
</div>
</body>
</html>