Creating a Animated Hoverable Navigation Menu Using HTML & CSS

Hello friend, I hope you are doing awesome. Today you will learn how to create a Animated Responsive Navigation Menu Bar in HTML & CSS. The interesting in this navbar menu is, the user-selected mode will not change while the webpage refreshed of the file is reopened. There are lots of Navigation Menu Bar but this navbar has some advanced features with beautiful UI and UX design.

A navigation bar is a horizontal section that contains navigation links aligned at the center of the webpage. The main motive of this navigation bar is to make it easier for users to be redirected from one webpage to another.

  1. HTML Structure

  2. Basic Styling

  3. Hover Effects

Other Beautiful Navebar

  1. HTML Structure

  2. <div class="container"> : Defines the navigation container with a class for styling.

    <ul"> : Creates a list for the menu items.

    <li> <a href="#"> : Each list item contains a link to different sections of the page.

  3. CSS Styling

  4. Reset Styles : Remove default margins and paddings to start with a clean slate.

    Navebar Styling : Apply a background color to the navigation bar and clear floats to handle layout.

    Menu List Styling : Remove bullets and float list items horizontally.

    Link Styling : Style link to appeare as block element with padding and set text color and alignment.

    Hover Effecct : Apply hover animation line of the link on hover.

Output


Output12
HTML
<!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="UTF-8">
        <meta name="viewport" content ="width=device-width, initial-scale=1.0">
        <title>Navigation Bar Hover Animation HTML CSS </title>
    </head>
  <body>
         <div class="container">
       <nav>
         <ul>
             <li><a class ="#">Home</a></li>
             <li><a href ="#">About</a></li>
             <li><a href ="#">Contact</a></li>
             <li><a href ="#">Services</a></li>
             <li><a href ="#">Help</a></li>
         </ul>
       </nav>
     </div>
   </body>
  </html>
CSS
/*default margins and paddings */
   * {
margin: 0;
padding: 0;
font-family: sans-serif;
box-sizing: border-box;
   }
/*Style the menu items */
   .container {
   background: #0fa566 ;
   display: flex ;
   align-items: center ;
   justify-content: center ;
   height : 100vh ;
   width: 100% ;
    }
   nav ul {
   background: #fff ;
    border-radius : 10px ;
    padding : 30px ;
    box-shadow : 0 6px 20px rgba(0, 0, 0, 0.3) ;
   }
   nav ul li {
   display: inline-block ;
   line-height : 50px ;
   list-style : none ;
   font-size : 30px ;
   padding : 0px 10px ;
   margin : 0px 20px ;
   cursor : pointer ;
   position : relative ;
   color : #333 ;
   }
   nav ul li a {
   text-decoration: none ;
   }
/* Change color on hover */
   nav ul li :after
{
   content:"" ;
   height : 3px ;
   width : 0px ;
   background : #0cecd4 ;
   position : absolute ;
   left : 0 ;
   bottom : -10px ;
   transition : 0.5s ;
   }
   nav ul li :hover::after {
   width : 100% ;
   }



BrodSchool

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

copyright © 2025 All Right Reserved.