-
CSS Navigation dropdown menu
HTML
CSS
JavaScript
Home
Services
Web Design
UI / UX
Mobile Apps
Brand Identity
Portfolio
Corporate
Ecommerce
Dashboard
Landing Page
Resources
Blog
Tutorials
Documentation
Contact
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } body { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; background: linear-gradient(135deg, #0f172a, #1e293b, #0f172a); padding-top: 80px; } /* Navigation */ nav { width: 1000px; background: rgba(255, 255, 255, .08); backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, .12); border-radius: 50px; padding: 10px 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, .35); margin: 50px; } .menu { display: flex; justify-content: center; list-style: none; } .menu>li { position: relative; margin: 0 8px; } .menu>li>a { display: block; padding: 16px 24px; color: #fff; text-decoration: none; font-size: 15px; font-weight: 500; border-radius: 40px; transition: .35s; position: relative; overflow: hidden; } /* Hover Background */ .menu>li>a::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #06b6d4, #3b82f6); transform: scaleX(0); transform-origin: left; transition: .4s; z-index: -1; border-radius: 40px; } .menu>li:hover>a::before { transform: scaleX(1); } .menu>li:hover>a { color: #fff; } /* Dropdown */ .dropdown { position: absolute; top: 75px; left: 50%; transform: translateX(-50%) translateY(25px); min-width: 220px; background: rgba(255, 255, 255, .08); backdrop-filter: blur(18px); border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; list-style: none; opacity: 0; visibility: hidden; transition: .4s; box-shadow: 0 20px 40px rgba(0, 0, 0, .35); } .menu li:hover .dropdown { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); z-index: 1; } .dropdown li { border-bottom: 1px solid rgba(255, 255, 255, .08); } .dropdown li:last-child { border: none; } .dropdown a { display: block; color: #fff; text-decoration: none; padding: 14px 20px; transition: .35s; } .dropdown a:hover { padding-left: 30px; background: rgba(255, 255, 255, .08); color: #4fd1ff; } /* Small Arrow */ .dropdown::before { content: ""; position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 16px; height: 16px; background: rgba(255, 255, 255, .08); border-left: 1px solid rgba(255, 255, 255, .1); border-top: 1px solid rgba(255, 255, 255, .1); } /* Underline Animation */ .menu>li>a::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 0; height: 2px; background: #fff; transition: .4s; transform: translateX(-50%); } .menu>li:hover>a::after { width: 60%; } /* Demo */ .hero { color: white; text-align: center; width: 600px; } .hero h1 { font-size: 60px; font-weight: 700; margin-bottom: 20px; color: #434747; } .hero p { opacity: .7; font-size: 18px; color: #434747; }
Live Preview