PRACTICAL WEB TIP
Tabbed Color Guide
A color strip and supporting caption move together across a tabbed menu.
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
<nav class="tbx-1285" aria-label="Sample navigation"><a href="#overview"><span class="tbx-1285__bar"></span><b>Overview</b><small>01</small></a><a href="#design"><span class="tbx-1285__bar"></span><b>Design</b><small>02</small></a><a href="#results"><span class="tbx-1285__bar"></span><b>Results</b><small>03</small></a></nav>
CSS
.tbx-1285{box-sizing:border-box;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:312px;max-width:100%;border:1px solid #e1e5e8;border-radius:10px;background:#f8f9fc;padding:5px;gap:3px;font-family:system-ui,sans-serif}
.tbx-1285 a{box-sizing:border-box;position:relative;isolation:isolate;overflow:hidden;min-width:0;text-decoration:none;display:flex;flex-direction:column;gap:3px;align-items:center;padding:16px 5px;color:#47566a;border-radius:7px;transition:color .3s}
.tbx-1285__bar{position:absolute;inset:0;z-index:-1;background:#334e73;transform:translateY(102%);transition:transform .38s cubic-bezier(.2,.8,.2,1)}
.tbx-1285 b{font-size:12px;white-space:nowrap}.tbx-1285 small{font-size:10px;letter-spacing:.13em;color:#9a9fad;transition:color .3s}
.tbx-1285 a:hover,.tbx-1285 a:focus-visible{color:#fff}.tbx-1285 a:hover small,.tbx-1285 a:focus-visible small{color:#b9d7f0}
.tbx-1285 a:hover .tbx-1285__bar,.tbx-1285 a:focus-visible .tbx-1285__bar{transform:translateY(0)}
.tbx-1285 a:focus-visible{outline:3px solid #77a7cf;outline-offset:-2px}
@media(prefers-reduced-motion:reduce){.tbx-1285 a,.tbx-1285__bar,.tbx-1285 small{transition:none}}
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 data dashboards.
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.