TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Nested Menu Reveal

A nested submenu and supporting information open beside the parent navigation item.

Live Demo

Hover over the element or use Tab to focus.

Source Code

Copy the HTML, CSS or JavaScript you need for your project.

HTML
<div class="tbx-1238"><nav class="menu" aria-label="Services menu"><a class="parent" href="#tb1238"><small>OUR EXPERTISE</small><b>Services <span aria-hidden="true">→</span></b></a><div class="child"><a href="#tb1238-a">Strategy <b>01</b></a><a href="#tb1238-b">Design <b>02</b></a><a href="#tb1238-c">Development <b>03</b></a></div></nav></div>
CSS
.tbx-1238{box-sizing:border-box;display:flex;align-items:center;justify-content:center;min-height:212px;width:100%;max-width:100%;padding:19px;overflow:hidden;font-family:system-ui,-apple-system,sans-serif;color:#18314a;}
.tbx-1238 * ,.tbx-1238 *::before,.tbx-1238 *::after{box-sizing:border-box}

.tbx-1238{background:#e7f0eb}.tbx-1238 .menu{width:min(100%,302px);height:162px;display:flex;overflow:hidden;border-radius:8px;box-shadow:0 12px 24px #224d3820;background:#fff}.tbx-1238 .parent{flex:0 0 57%;min-width:0;background:#225449;color:#fff;text-decoration:none;display:grid;align-content:center;gap:16px;padding:16px;transition:flex-basis .4s}.tbx-1238 .parent small{font-size:9px;letter-spacing:.12em;color:#b5dace;font-weight:800}.tbx-1238 .parent b{font-size:19px;white-space:nowrap}.tbx-1238 .parent b span{font-size:15px;margin-left:5px}.tbx-1238 .child{display:grid;align-content:center;gap:3px;min-width:0;flex:1;padding:12px 9px}.tbx-1238 .child a{display:flex;gap:5px;justify-content:space-between;color:#356254;text-decoration:none;white-space:nowrap;overflow:hidden;font-size:11px;padding:7px 6px;border-radius:3px;opacity:.35;transform:translateX(9px);transition:background .3s,transform .35s,opacity .35s}.tbx-1238 .child a b{font-size:9px;color:#97a99d}.tbx-1238 .menu:is(:hover,:focus-within) .parent{flex-basis:49%}.tbx-1238 .menu:is(:hover,:focus-within) .child a{opacity:1;transform:translateX(0)}.tbx-1238 .child a:is(:hover,:focus-visible){background:#e3f0e9}.tbx-1238 a:focus-visible{outline:2px solid #e7a455;outline-offset:-2px}

@media(prefers-reduced-motion:reduce){.tbx-1238 *, .tbx-1238 *::before,.tbx-1238 *::after{transition-duration:0.01ms!important;animation-duration:0.01ms!important;scroll-behavior:auto!important}}

How to Use

Insert the HTML and add the CSS to your stylesheet. Adjust colors and sizes and avoid class conflicts.

Use Case

Useful for navigation menus and company websites.

Technical Notes

Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.

Mobile:Ensure the interactive content remains accessible without hover on touch devices.

Browser:Uses modern CSS. Check behavior in the browsers you support.

Reduced Motion:Check that prefers-reduced-motion is respected.