Sure! Below is an example of a Glassmorphism style Navbar with:
- Two main buttons: Home and In My Courses (which has a dropdown with "All Courses", "Courses" and "Course Detail")
- A Pages dropdown with "Blog Section" and "About Us"
- A Contact page link
This navbar uses HTML and CSS with a glass effect and simple dropdown functionality using CSS only. You can enhance it further with JS or frameworks if you'd like.
Complete Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Glassmorphism Navbar</title>
<style>
/* Reset & base */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1350&q=80') no-repeat center/cover;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: flex-start;
}
/* Navbar container */
nav {
width: 100%;
max-width: 1200px;
margin-top: 40px;
background: rgba(255, 255, 255, 0.12);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-radius: 12px;
box-shadow:
0 4px 30px rgba(0,0,0,0.1);
padding: 0 30px;
}
nav ul {
list-style: none;
display: flex;
align-items: center;
height: 60px;
}
nav ul li {
position: relative;
}
nav > ul > li {
margin-right: 30px;
}
/* Links */
nav a {
display: block;
color: #fff;
text-decoration: none;
padding: 18px 10px;
font-weight: 600;
font-size: 16px;
transition: color 0.3s ease;
user-select: none;
}
nav a:hover {
color: #74ebd5;
}
/* Dropdown Styles */
nav ul li ul {
position: absolute;
top: 60px;
left: 0;
background: rgba(255, 255, 255, 0.12);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-radius: 8px;
box-shadow:
0 8px 24px rgba(0,0,0,0.2);
min-width: 180px;
opacity: 0;
visibility: hidden;
transform: translateY(15px);
transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
z-index: 99;
}
nav ul li:hover > ul {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
nav ul li ul li {
margin: 0;
}
nav ul li ul li a {
padding: 12px 15px;
font-weight: 400;
font-size: 15px;
}
nav ul li ul li a:hover {
background-color: rgba(116, 235, 213, 0.2);
color: #74ebd5;
}
/* Caret icon for dropdown */
nav ul li.has-dropdown > a::after {
content: ' ▼';
font-size: 0.6em;
margin-left: 6px;
font-weight: normal;
}
/* Responsive */
@media (max-width: 768px) {
nav ul {
flex-direction: column;
align-items: flex-start;
height: auto;
padding: 15px 0;
}
nav > ul > li {
margin-right: 0;
width: 100%;
}
nav ul li ul {
position: static;
transform: none;
opacity: 1 !important;
visibility: visible !important;
box-shadow: none;
backdrop-filter: none;
background: transparent;
padding-left: 15px;
border-radius: 0;
}
nav ul li ul li a:hover {
background-color: transparent;
color: #74ebd5;
}
}
</style>
</head>
<body>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li class="has-dropdown">
<a href="#">In My Courses</a>
<ul>
<li><a href="#">All Courses</a></li>
<li><a href="#">Courses</a></li>
<li><a href="#">Course Detail</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Pages</a>
<ul>
<li><a href="#">Blog Section</a></li>
<li><a href="#">About Us</a></li>
</ul>
</li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</body>
</html>
How it works:
- The navbar has a transparent glass background with
rgba(255,255,255,0.12) plus backdrop-filter: blur(12px) for the blur effect.
- The dropdown menus appear on hover with a fade and translate effect.
- The "In My Courses" and "Pages" menu items have dropdowns.
- The caret (▼) is added using CSS
::after to indicate dropdown items.
- Simple responsive styles stack the menu vertically on smaller screens and show dropdown items inline.
If you want me to integrate this using React, Vue, or add JS dropdown toggles for mobile, just let me know!