CSS Navigation Menu✨
A Nevigation menu (nav bar) is one of the most important parts of any website. It helps visitors move between pages easily and improves the user experience.
In this article, you will learn how to create a simple, clean navigation menu.
🌟 What you will Learn in This Article
- What a navigation menu is
- How to design a simple HTML structure
- How to style a nav bar using CSS
✨What is a navigation menu?
A Nevigation menu is a group of links placed at the top of a website that help users move between pages like Home, Contact, About us etc.
Example:-
Home/About us/Gallery/Contact
✨Why Navigation menu are important?
A good CSS Menu
- Makes your website look professional
- Improves users experience
- Makes readers stay longer on your website
- Boosts SEO and page views
✍️Types of Navigation Menu
Different websites use different kinds of navigation menu.Here are some of the most common type.
- Horizontal Menu: This is the most common type. It appears at the top of the website in a straight line.
- Vertical Sidebar Menu: Used mostly in dashboards, blogs, and admin panels. It appears on the left or right side.
- Sticky (fixed) Menu: This menu stays at the top even when the user scrolls the page
- Dropdown Menu: A menu with sub-items that appears when hovering over a link.
- Hamburger Mobile Menu: The three-line icon used in mobile website to open and close the menu.
Let's try to create a Horizontal menu:
✅Step 1 : create the HTML structure
<nav class="nav">
<ul class="menu">
<li><a href="#">Home</a></li>
<li><a href="#">About </a></li>
<li><a href="#">Contact </a></li>
<li><a href="#">Gallery</a></li>
</ul>
</nav>
✅Step 2 : Apply CSS design
.nav{
background:teal;
padding:10px 20px;
display:flex;
justify-content:space-between;
align-items:center;
}
.logo{
color:white;
font-size:20px;
font-weight:bold;
}
.menu{
list-style:none;
margin:0;
padding:0;
display:flex;
gap:15px;
}
.menu li a{
color:white;
text-decoration:none;
padding:8px 12px;
border-radius:5px;
}
Here output is:
✅Crate a HTML structure and apply CSS styles
❓ Frequently Asked Questions (FAQs):
1. What is the best navigation menu for mobile?
2. Can I make a menu without javascript?
3. Which CSS property creates horizontal menus?
4. How do I center menu items?
Use:-


Comments
Post a Comment