CSS Button Hover Animation Effects - Only HTML & CSS Used by CupCode

In this article you will able to learn CSS Button Hover Animations Effects where we using only HTML & CSS. This a beginner tutorial of this CSS Button Hover Effect so that everyone can learn it. I will be using two buttons for CSS Hover effects. In this tutorial I will be using background color hovering effect of CSS. So watch till the end.

"index.html" Code:-

"index.html" Code:-
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CupCode</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <button class="button">Red</button>
    <button class="button button2">Green</button>
</body>
</html>

"style.css" Code:-

"style.css" Code:-
.button{
    color:black;
    background-color: white;
    border: 2px solid red;
    padding: 16px 32px;
    font-size: 32px;
    text-align: center;
    cursor: pointer;
    transition-duration: 0.6s;
}

.button:hover{
    background-color: red;
    color: white;
}

.button2{
    background-color: white;
    color: black;
    border: 2px solid #0be000;
}

.button2:hover{
    background-color: #0be000;
    color: white;
}

Video Tutorial:-