In this tutorial we will see how to make a Cool CSS Button with Hover Animation. Simple CSS is used for this purpose, HTML code and CSS code is given.
Table of Contents
HTML Code
HTML Code is given below.
<button class='btn'>Click Me</button>
CSS Code
CSS Code is given below.
<style>
body
{
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
.btn
{
font-family: 'Barlow Condensed' ,sans-serif;
position: relative;
font-size: 30px;
padding: 5px 20px;
background-color: transparent;
color: #FF0033;
border: 5px solid #FF0033;
box-shadow: 4px 4px 0px 0px #666;
cursor: pointer;
transition: 0.7s;
}
.btn::before
{
position: absolute;
content: '';
left: 0px;
top: 0px;
width: 0%;
height: 100%;
background-color: #FF0033;
transition: 0.4s;
z-index: -1;
}
.btn:hover
{
color: #fff;
}
.btn:hover::before
{
width: 100%;
}
</style>
Video Tutorial
Watch our video tutorial on Cool CSS Button with Hover Animation.