Skip to main content
<CodeWithBhurtel/>
HomeLearnProjectsChallengesBlogAboutContactLogin
<CodeWithBhurtel/>

Learn through structured lessons, real projects, and live challenges. Free tutorials for HTML, CSS, JavaScript, and more.

Pages

  • Home
  • Learn
  • Blog
  • Projects
  • Challenges
  • About
  • Contact

Lessons

  • HTML
  • CSS
  • JavaScript

© 2026 CodeWithBhurtel. All rights reserved.

Privacy PolicyTerms & Conditions
Projects

Navigation Bar Menus Got Magical

IntermediateHTML, CSS, JavaScript

Navigation Bar Menus Got Magical – project preview
Share this project
Follow me on social media

Understand the code

Read a plain-language overview or a file-by-file breakdown. Ask questions about the project below the overview.

Overview: Navigation Bar Menus Got Magical

This project creates an interactive, animated navigation bar designed for modern web or mobile interfaces. Its primary purpose is to provide a "magical" user experience where menu items respond dynamically to user clicks. When an item is selected, the icon pops out of the bar, changes color, and reveals a text label, making the navigation feel fluid and responsive.

The structure is built using a standard HTML unordered list, where each list item represents a navigation tab containing an icon and a text span. The visual design relies on CSS Flexbox for alignment and a dark-themed aesthetic with soft shadows to give the navigation bar a 3D, "skeuomorphic" look.

The "magic" logic is handled by a small JavaScript snippet that manages the "active" state. When a user clicks a menu item, JavaScript toggles a specific CSS class. This class triggers various CSS transitions, such as moving the icon upwards using vertical transformations and fading in the text label with a slight delay to create a polished animation sequence.

Key Code Snippets

The HTML structure uses list items to hold the icons and labels, with an "active" class used to highlight the current selection.

<li class="active">
  <a href="#">
    <span class="icon"><ion-icon name="home-outline"></ion-icon></span>
    <span class="text">Home</span>
  </a>
</li>

This JavaScript function manages the navigation logic by removing the "active" class from all items and applying it only to the one the user just clicked.

function activeLink() {
  list.forEach((item) => item.classList.remove("active"));
  this.classList.add("active");
}

In the CSS, the transform property is used to lift the icon out of the navigation bar when its parent item becomes active.

.navigation li.active a .icon {
  background: #29fd53;
  color: #fff;
  transform: translateY(-55px);
}

To create a glowing effect, the project uses a pseudo-element (::before) that changes color and adds multiple layers of box-shadows when a link is clicked.

.navigation li.active::before {
  background: #0f0;
  box-shadow: 0 0 5px #0f0, 0 0 10px #0f0, 0 0 20px #0f0;
}

Ask about this project

Have a question about how this project works? Ask below and get an answer based on the project code.

Code Breakdown

Structured technical breakdown for beginners.

No breakdown yet. Generate one to see a file-by-file explanation.

Comments

No comments yet. Sign in to leave a comment.

Sign in to leave a comment.