<div class="container">
<h1>Pure Css Button Hover effect</h1>
<a href="#" class="button">Hover me</a>
<!-- optional -->
<span>Made by <a href="http://alticreation.com/en">alticreation.com</a></span>
</div>
$color: #0cf;
.button {
display: inline-block;
padding: .75rem 1.25rem;
border-radius: 10rem;
color: #fff;
text-transform: uppercase;
font-size: 1rem;
letter-spacing: .15rem;
transition: all .3s;
position: relative;
overflow: hidden;
z-index: 1;
&:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: $color;
border-radius: 10rem;
z-index: -2;
}
&:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 100%;
background-color: darken($color, 15%);
transition: all .3s;
border-radius: 10rem;
z-index: -1;
}
&:hover {
color: #fff;
&:before {
width: 100%;
}
}
}
/* optional reset for presentation */
* {
font-family: Arial;
text-decoration: none;
font-size: 20px;
}
.container {
padding-top: 50px;
margin: 0 auto;
width: 100%;
text-align: center;
}
h1 {
text-transform: uppercase;
font-size: .8rem;
margin-bottom: 2rem;
color: #777;
}
span {
display: block;
margin-top: 2rem;
font-size: .7rem;
color: #777;
a {
font-size: .7rem;
color: #999;
text-decoration: underline;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.