CSS Tricks3
2D to 3D Button hovering effects
by Soya Natsuki
HTML
<html>
<head>
<title>Button Hover Effects - 2D to 3D</title>
</head>
<body>
<a href="#">Hover</a>
</body>
</html>
CSS
body {
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: #2196f3;
}
a {
position: relative;
padding: 20px 20px 20px 30px;
color: #fff;
font-size: 20px;
text-decoration: none;
text-transform: uppercase;
letter-spacing: 10px;
transition: .5s;
}
a:hover {
background: #2196f3;
transition-delay: .2s;
box-shadow: -30px 30px 50px rgba(0,0,0,.4);
transform: rotate(-30deg) skew(25deg);
}
a:before,
a:after {
content: '';
position: absolute;
width: 2px;
height: 100%;
background: #fff;
pointer-events: none;
transform-style: linear;
transition-property: width,opacity,transform,box-shadow;
transition-duration: .5s;
}
a:before {
top: 0;
left: 0;
}
a:after {
top: 0;
right: 0;
}
a:hover:before {
width: 100%;
opacity: 0.1;
transform: translate(5px,-5px);
box-shadow: +2px 2px 2px rgba(0,0,0,.1);
transition-delay: 0s, .5s, 1s, 1.5s;
}
a:hover:after {
width: 100%;
opacity: 0.1;
transform: translate(10px,-10px);
box-shadow: +2px 2px 2px rgba(0,0,0,.1);
transition-delay: 0s, .5s, 1s, 1.5s;
}