Problem: Glass Mega Dropdown Menu

hard
40 min
Try to build a responsive navbar with glass-style mega-dropdowns that reveal grid-based submenus on hover or focus.

Problem description

Given HTML markup for a <nav> containing an unordered list of menu items, each optionally wrapping a <div class="dropdown"> with submenu links, write CSS to:

  • Style the navbar with a frosted-glass background and blurred backdrop.

  • Position .dropdown panels absolutely below the navbar, hidden by default (opacity: 0; visibility: hidden).

  • Reveal each .dropdown on hover of its parent <li> or :focus-within, transitioning opacity and visibility.

  • Use CSS Grid inside the dropdown to lay out links in 4 columns on large screens, collapsing to 2 columns on small screens via a media query.

  • Apply background: rgba(255,255,255,0.2), backdrop-filter: blur(8px), padding, border-radius, and box-shadow to dropdown panels.

  • Ensure the navbar remains fixed at the top and the layout adapts across viewports.

Goal

Write CSS rules to implement a glassmorphic, responsive mega-dropdown menu using hover/focus states, CSS Grid, and backdrop-filter for visual depth, without any JavaScript.

Constraints

  • Use only CSS (no JavaScript).

  • Navbar should be fixed at top, full width, height 60px, and display: flex;, with gap between items.

  • Dropdown panels should be position: absolute; top: 60px; left: 0; width: 100%; max-width: 1200px; margin: 0 auto; hidden by default, show on li:hover > .dropdown or li:focus-within > .dropdown.

  • Dropdown background should be rgba(255,255,255,0.2) with backdrop-filter: blur(8px), border-radius: 8px, box-shadow: 0 4px 8px rgba(0,0,0,0.1).

  • Use display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; inside dropdown; include a media query at max-width: 768px to switch to repeat(2,1fr).

  • Transition should be opacity 0.3s ease, visibility instant.

Sample visual output

Here’s what the output would look like:

Good luck trying the problem! If you’re unsure how to proceed, check the Solution.

Problem: Glass Mega Dropdown Menu

hard
40 min
Try to build a responsive navbar with glass-style mega-dropdowns that reveal grid-based submenus on hover or focus.

Problem description

Given HTML markup for a <nav> containing an unordered list of menu items, each optionally wrapping a <div class="dropdown"> with submenu links, write CSS to:

  • Style the navbar with a frosted-glass background and blurred backdrop.

  • Position .dropdown panels absolutely below the navbar, hidden by default (opacity: 0; visibility: hidden).

  • Reveal each .dropdown on hover of its parent <li> or :focus-within, transitioning opacity and visibility.

  • Use CSS Grid inside the dropdown to lay out links in 4 columns on large screens, collapsing to 2 columns on small screens via a media query.

  • Apply background: rgba(255,255,255,0.2), backdrop-filter: blur(8px), padding, border-radius, and box-shadow to dropdown panels.

  • Ensure the navbar remains fixed at the top and the layout adapts across viewports.

Goal

Write CSS rules to implement a glassmorphic, responsive mega-dropdown menu using hover/focus states, CSS Grid, and backdrop-filter for visual depth, without any JavaScript.

Constraints

  • Use only CSS (no JavaScript).

  • Navbar should be fixed at top, full width, height 60px, and display: flex;, with gap between items.

  • Dropdown panels should be position: absolute; top: 60px; left: 0; width: 100%; max-width: 1200px; margin: 0 auto; hidden by default, show on li:hover > .dropdown or li:focus-within > .dropdown.

  • Dropdown background should be rgba(255,255,255,0.2) with backdrop-filter: blur(8px), border-radius: 8px, box-shadow: 0 4px 8px rgba(0,0,0,0.1).

  • Use display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; inside dropdown; include a media query at max-width: 768px to switch to repeat(2,1fr).

  • Transition should be opacity 0.3s ease, visibility instant.

Sample visual output

Here’s what the output would look like:

Good luck trying the problem! If you’re unsure how to proceed, check the Solution.