TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Index-Led Menu

A navigation index shifts sideways as an underline animates beneath the linked label.

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-1074" aria-label="Section navigation"><a href="#service"><small>01</small><span>Services</span><b aria-hidden="true">↗</b></a><a href="#about"><small>02</small><span>About us</span><b aria-hidden="true">↗</b></a><a href="#contact"><small>03</small><span>Contact</span><b aria-hidden="true">↗</b></a></nav>
CSS
.tbx-1074{width:min(300px,100%);font:12px/1.4 system-ui,sans-serif;background:#fff;padding:11px 16px;border:1px solid #dfe5eb;border-radius:8px}
.tbx-1074 a{position:relative;display:flex;align-items:center;gap:12px;min-height:54px;color:#2d475e;text-decoration:none;border-bottom:1px solid #e8edf0;overflow:hidden}
.tbx-1074 a:last-child{border-bottom:0}.tbx-1074 small{color:#8fa2ab;font-size:10px;transition:transform .25s,color .25s;font-weight:800}.tbx-1074 a span{font-size:12px;font-weight:700;transition:transform .3s}
.tbx-1074 a b{font-weight:400;font-size:17px;margin-left:auto;opacity:0;transform:translate(-9px,6px);transition:transform .3s,opacity .3s}
.tbx-1074 a:after{position:absolute;content:"";height:2px;bottom:0;left:0;right:0;background:#df9260;transform:scaleX(0);transform-origin:left;transition:transform .34s}
.tbx-1074 a:is(:hover,:focus-visible) small{transform:translateX(6px);color:#bc6b37}.tbx-1074 a:is(:hover,:focus-visible) span{transform:translateX(6px)}.tbx-1074 a:is(:hover,:focus-visible) b{transform:translate(0,0);opacity:1}
.tbx-1074 a:is(:hover,:focus-visible):after{transform:scaleX(1)}.tbx-1074 a:focus-visible{outline:2px solid #df9260;outline-offset:2px}
@media(prefers-reduced-motion:reduce){.tbx-1074 *, .tbx-1074 a:after{transition:none!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.