Creating a Animated Hoverable Button Using HTML & CSS

Hello friend, I hope you are doing great. Today you will learn how to create an animated button using HTML and CSS. The interesting thing in this button is that the user selected button has some advanced features with beautiful UI and UX design.

  1. Basic Style

  2. Hover Effects

Output


img-out

Other Beautiful Navebar

HTML
<!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="UTF-8">
        <meta name="viewport" content ="width=device-width, initial-scale=1.0">
        <title>Animated Hover Button </title>
    </head>
  <body>
         <button class="btn">Hover Me !  </button>
   </body>
  </html>
CSS
/*Style the menu items */
   body {
   background: #161616 ;
   display: flex ;
   align-items: center ;
   justify-content: center ;
   min-height : 100vh ;
   width: 100% ;
    }
   .btn {
   margin: 100px ;
   border: none ;
   color: #fff ;
   cursor: pointer ;
   position: relative ;
   z-index: 0 ;
   font-size: 29px ;
    border-radius : 10px ;
    padding : 15px 38px ;
    box-shadow : 0  6px  20px  rgba(0, 0, 0, 0.3) ;
   }
   .btn::after {
   content: '' ;
   z-index : -1 ;
   position : absolute ;
   width : 100% ;
   height : 100% ;
   background : #333 ;
   left : 0 ;
   top : 0 ;
   border-radius : 10px ;
   }
/* Change color */
   btn ::before
{
   content:  "" ;
   background : linear-gradient(45deg,#FF0000,#FF7300,#FFFB00,#48FF00,#00FFD5,#002BFF,#FF00CB,#FF0000) ;
   position : absolute ;
   left : -2px ;
   left : -2px ;
   background-size : 600% ;
   z-index : -1 ;
   width : calc(100% + 4px) ;
   height : calc(100% + 4px) ;
   filter : blur(8px) ;
   animation : glow 18s linear infinite ;
   transition : opacity 0.3s ease-in-out ;
   border-radius : 10px ;
   opacity : 0 ;
   }
   @keyframes glow {
   0% {
   background-position : 0  0 ;
   }
   50% {
   background-position : 100%  0 ;
    }
  }
/* Change color on hover */
   .btn :hover::before
{
   opacity : 1 ;
   }
   .btn :active::before
{
   background : transparent ;
   }
   .btn :active {
   background : transparent ;
   }



BrodSchool

Jagatpur,
Raebareli 229402, UP,  India
Amresh Kumar (Founder)
Phone: +91 9198 26 3500
Email:suportucracker@gmail.com

copyright © 2025 All Right Reserved.