HTML Explanation
01
The HTML structure begins with a navigation menu enclosed within a div element with the class navigation.
02
Inside the ul list, each li represents a menu item containing a link (a).
03
Each link includes an icon and text.
04
The ion-icon elements provide scalable vector icons, sourced from the Ionicons library, which is included via <script> tags.
CSS Explanation
01
The CSS styles the navigation bar and controls the appearance and behavior of the icons and text.
02
The navigation menu has a dark background and is positioned centrally using flexbox.
03
Each list item (li) is styled to have a fixed width and height, ensuring a uniform layout. The icons within each menu item are styled to appear above their respective text. When a menu item is active or hovered over, its icon is highlighted, and the text appears with an animation.
04
A special .indicator element is positioned absolutely within the navigation container. This indicator is styled to highlight the active menu item by sliding underneath it, creating a dynamic visual cue.
05
The .indicator::before pseudo-element adds a subtle highlight effect below the active item.
Javascript Explanation
01
It selects all elements with the class list (each menu item) and adds an event listener to them.
02
When a menu item is clicked, the activelink function prevents the default behavior, removes the active class from all items, and then adds it to the clicked item.
03
This triggers the CSS transitions that animate the indicator and change the icon and text styling for the active item.