Skip to content

Mega Menu with Featured Image Cards

Responsive Tailwind CSS mega menu with grouped link columns, featured photo cards, keyboard support and a mobile accordion layout.

Also known as: mega menu with images, large dropdown navigation, website mega menu, navigation with featured cards, mega dropdown menu

Mega Menu with Featured Image Cards live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A responsive mega menu built with Tailwind CSS and vanilla JavaScript for a travel brand: each top-level item opens a full-width panel with grouped link lists on the left and featured image cards on the right. It suits travel, e-commerce and publishing sites that promote highlighted content inside the main navigation.

How it works

The root is .mmf-root, which contains the header and some sample page content. Inside the header, nav#mmf-nav (.mmf-nav) holds a list with two .mmf-trigger buttons, two plain links and a call-to-action. Each trigger points with aria-controls to its .mmf-panel. A panel is a 12-column grid: the left seven columns hold link groups with .mmf-link items, the right five hold .mmf-card links with a photo, a dark gradient overlay and a title with price.

From the lg breakpoint the panel is positioned with lg:absolute lg:inset-x-0 lg:top-full, so it spans the whole header and drops below it with the mmf-drop animation. Below lg the nav is hidden behind the .mmf-burger button and the panels become stacked accordions inside it.

The script initializes every .mmf-root on DOMContentLoaded. A click on a trigger flips aria-expanded and the panel's hidden attribute; on desktop it closes other panels first. Escape closes the open panel (or the mobile menu) and returns focus. Clicking or tabbing outside the header closes desktop panels. The Destinations panel starts open as a desktop preview; on phones the script collapses it on load.

Customization

  • aria-expanded="true" on the first .mmf-trigger and the missing hidden on #mmf-panel-destinations: set aria-expanded="false" and add hidden so every panel starts closed.
  • lg:col-span-7 and lg:col-span-5 inside a panel: change the split between link lists and featured cards, for example 8 and 4 with a single card.
  • lg:aspect-[3/4] on the card images: use lg:aspect-square for shorter cards and a lower panel.
  • bg-emerald-700, text-emerald-700 and #047857 in style.css (.mmf-link:hover, .mmf-trigger[aria-expanded="true"]): swap for your brand color.
  • bg-[#fbf8f2] on the header and .mmf-nav: change the bar background; keep both values equal so the mobile menu matches.
  • The New route badge (bg-amber-300) inside a .mmf-card: copy it to other cards or remove it.
  • min-width: 64rem in both style.css and script.js: change both together if you move the desktop breakpoint from lg to xl.

Use cases

  • Ecommerce stores: grouped link columns and featured photo cards guide shoppers to key categories
  • Large corporate sites: many pages fit into one organized dropdown panel
  • Content publishers: featured cards promote articles or collections inside the menu
  • Mobile navigation: the menu turns into an accordion on small screens with keyboard support

Accessibility

Triggers are real buttons with aria-expanded and aria-controls, the nav has aria-label="Main", and the burger button has a screen-reader label plus aria-expanded. Panels are closed with the hidden attribute, so collapsed links are out of the Tab order. Escape closes menus and restores focus. Every image has a descriptive alt, width, height and decoding="async", and cards in the closed panel use loading="lazy". Links and buttons have visible emerald focus outlines, decorative icons and overlays are aria-hidden, and animations stop under prefers-reduced-motion: reduce.

Usage notes

The photos come from Unsplash; replace them with your own images. The demo links use href="#" and the script prevents navigation for them; real URLs work normally. Several menus on one page work, as long as each panel id is unique.

Mega Menu with Featured Image Cards at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Mega Menus
License
Free for personal and commercial use

Questions about this template

Can I use the Mega Menu with Featured Image Cards code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Mega Menu with Featured Image Cards – free Tailwind CSS mega menu template
Mega Menu with Featured Image Cards · free Tailwind CSS mega menu template

More Mega Menus

Bootstrap Mega Menu Dropdown – free Bootstrap 5 mega menu template

Bootstrap Mega Menu Dropdown

Full-width Bootstrap 5 mega menu with icon feature links, link columns and a gradient promo block, keyboard friendly and stacked on mobile.

Products Mega Menu – free Tailwind CSS mega menu template

Products Mega Menu

Tailwind CSS mega menu with two columns of product links, icons and descriptions, a featured promo card and full keyboard support.