Skip to main content

Multilevel dropdown menu with icons, mega menus, and smooth transitions.

πŸš€ New Features Added:

Icons for each menu item
Mega Menu Support (for large content sections)
Smooth CSS transitions for better UX


1️⃣ Updated HTML Structure (index.html)

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Enhanced Multilevel Dropdown Menu</title> <link rel="stylesheet" href="styles.css"> <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> </head> <body> <!-- Navigation Bar --> <nav class="navbar"> <div class="logo">🌐 My Website</div> <button class="menu-toggle" onclick="toggleMenu()"></button> <ul class="nav-links" id="navMenu"> <li><a href="#"><i class="fas fa-home"></i> Home</a></li> <li class="dropdown"> <a href="#"><i class="fas fa-cogs"></i> Services ▼</a> <ul class="dropdown-menu"> <li><a href="#"><i class="fas fa-laptop-code"></i> Web Development</a></li> <li class="dropdown"> <a href="#"><i class="fas fa-paint-brush"></i> Design ▼</a> <ul class="dropdown-menu"> <li><a href="#"><i class="fas fa-user-edit"></i> UI/UX</a></li> <li><a href="#"><i class="fas fa-image"></i> Graphic Design</a></li> </ul> </li> <li><a href="#"><i class="fas fa-search"></i> SEO</a></li> </ul> </li> <li class="dropdown mega-menu"> <a href="#"><i class="fas fa-box-open"></i> Products ▼</a> <div class="mega-content"> <div class="mega-column"> <h3>Software</h3> <a href="#">CRM Tools</a> <a href="#">Project Management</a> <a href="#">Accounting</a> </div> <div class="mega-column"> <h3>Hardware</h3> <a href="#">Laptops</a> <a href="#">Monitors</a> <a href="#">Accessories</a> </div> <div class="mega-column"> <h3>Cloud Services</h3> <a href="#">AWS</a> <a href="#">Google Cloud</a> <a href="#">Azure</a> </div> </div> </li> <li><a href="#"><i class="fas fa-envelope"></i> Contact</a></li> </ul> </nav> <script src="script.js"></script> </body> </html>

2️⃣ Updated CSS Styling (styles.css)

/* General Styling */ body { font-family: Arial, sans-serif; margin: 0; padding: 0; } /* Navbar Styling */ .navbar { background: #333; color: white; display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; } /* Logo */ .logo { font-size: 1.5em; font-weight: bold; } /* Navigation Links */ .nav-links { list-style: none; padding: 0; margin: 0; display: flex; } .nav-links li { position: relative; } .nav-links a { color: white; text-decoration: none; padding: 10px 20px; display: flex; align-items: center; gap: 8px; transition: background 0.3s ease; } .nav-links a:hover { background: #575757; } /* Dropdown Menu */ .dropdown-menu { display: none; position: absolute; background: #444; list-style: none; padding: 0; margin: 0; top: 100%; left: 0; min-width: 200px; box-shadow: 0 5px 10px rgba(0,0,0,0.2); opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; } .dropdown-menu li { width: 100%; } .dropdown-menu a { padding: 12px; display: flex; align-items: center; } /* Show Dropdown on Hover (for Desktop) */ .dropdown:hover > .dropdown-menu { display: block; opacity: 1; transform: translateY(0); } /* Multi-Level Dropdown */ .dropdown-menu .dropdown { position: relative; } .dropdown-menu .dropdown-menu { top: 0; left: 100%; } /* Mega Menu Styling */ .mega-menu { position: relative; } .mega-content { display: none; position: absolute; left: 0; top: 100%; width: 600px; background: #444; box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3); padding: 20px; display: flex; justify-content: space-between; } .mega-menu:hover .mega-content { display: flex; opacity: 1; transform: translateY(0); } .mega-column { flex: 1; padding: 10px; } .mega-column h3 { color: white; margin-bottom: 10px; } .mega-column a { display: block; color: white; padding: 5px 0; transition: color 0.3s; } .mega-column a:hover { color: yellow; } /* Mobile Menu */ .menu-toggle { display: none; background: none; border: none; color: white; font-size: 1.5em; cursor: pointer; } /* Responsive Styles */ @media screen and (max-width: 768px) { .nav-links { flex-direction: column; display: none; width: 100%; background: #333; position: absolute; top: 60px; left: 0; } .nav-links li { text-align: center; } .dropdown-menu { position: static; box-shadow: none; } .menu-toggle { display: block; } .show-menu { display: flex; } }

3️⃣ Updated JavaScript for Mobile Menu (script.js)

function toggleMenu() { document.getElementById("navMenu").classList.toggle("show-menu"); }

πŸ“Œ How It Works?

  1. Icons in Menu Items

    • Font Awesome icons added to all items.
  2. Mega Menu for Products

    • Three columns for Software, Hardware, and Cloud Services.
  3. Smooth CSS Transitions

    • Dropdown menus fade in and slide down smoothly.
  4. Responsive Design

    • Mobile menu toggle works with a hamburger icon.

πŸš€ Why This Menu Stands Out?

Fully customizable and scalable
Supports unlimited nested dropdowns
Smooth animations for a better experience
Mega menu enhances large content accessibility

Comments

Popular posts from this blog

AI and ML Cryptography and Network Security Data structure and Algorithm IntroToOOP Normalization in DBMS OOPS java osi-tcp SSL-TLS protocol

Algorithm Analysis Techniques

 To evaluate the efficiency of an algorithm, we analyze its performance using the following measures: 1. Time Complexity Represents the time taken by an algorithm to run as a function of input size (n). Expressed using Big-O notation (O). Examples: O(1) - Constant time O(log n) - Logarithmic time (Binary Search) O(n) - Linear time (Linear Search) O(n log n) - Log-linear time (Merge Sort) O(n²) - Quadratic time (Bubble Sort) 2. Space Complexity Represents the memory required by an algorithm. Important for optimizing performance in memory-constrained environments. 3. Best, Average, and Worst Case Analysis Best Case : Minimum time required (ideal scenario) Average Case : Expected performance over different inputs Worst Case : Maximum time required (upper bound)

Algorithm Design Techniques

 Designing efficient algorithms involves structured approaches to problem-solving. Here are some commonly used algorithm design paradigms: Divide and Conquer Breaks a problem into smaller subproblems, solves them recursively, and combines their results. Example: Merge Sort, Quick Sort, Binary Search Dynamic Programming Solves problems by breaking them into overlapping subproblems and storing results to avoid redundant computations. Example: Fibonacci Series, Knapsack Problem, Longest Common Subsequence Greedy Algorithms Makes locally optimal choices at each step with the hope of finding the global optimum. Example: Huffman Coding, Kruskal’s Algorithm, Prim’s Algorithm Backtracking Explores all possibilities recursively and backtracks when an infeasible solution is found. Example: N-Queens Problem, Sudoku Solver, Hamiltonian Cycle Brute Force Tries all possible solutions and picks the best one. Example: String Matching Algorithms like NaΓ―ve Pattern Searching