TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Tandem Word Highlight

Three heading words move across color panels and become emphasized together.

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 tabindex="0" class="tbx-1292" role="group" aria-label="Design with intention"><span><i></i>DESIGN</span><span><i></i>WITH</span><span><i></i>INTENTION.</span><small>HOVER FOR EMPHASIS</small></div>
CSS
*{box-sizing:border-box}
.tbx-1292{width:300px;max-width:100%;height:147px;display:flex;flex-wrap:wrap;align-content:center;align-items:center;justify-content:center;gap:5px 6px;padding:20px 10px 24px;background:#1c213c;color:#fff;border-radius:10px;font-family:system-ui,sans-serif;overflow:hidden;cursor:default}.tbx-1292>span{position:relative;isolation:isolate;display:block;padding:7px 5px;font-size:23px;letter-spacing:-.07em;font-weight:900;line-height:1.1}.tbx-1292>span i{position:absolute;inset:0;z-index:-1;transform:scaleX(0);transform-origin:left;transition:transform .4s;transition-delay:0s;background:#f5ae51}.tbx-1292>span:nth-child(2) i{background:#9cc0d3;transform-origin:right}.tbx-1292>span:nth-child(3) i{background:#d1afd5}.tbx-1292>span:nth-child(2){color:#eecb93}.tbx-1292>span:nth-child(3){color:#d7d7e3}.tbx-1292>small{display:block;width:100%;text-align:center;font-size:9px;letter-spacing:.18em;color:#91a0c7;margin-top:3px}.tbx-1292:hover>span i,.tbx-1292:focus-visible>span i{transform:scaleX(1);transition-delay:.08s}.tbx-1292:hover>span:nth-child(2) i,.tbx-1292:focus-visible>span:nth-child(2) i{transition-delay:.2s}.tbx-1292:hover>span:nth-child(3) i,.tbx-1292:focus-visible>span:nth-child(3) i{transition-delay:.3s}.tbx-1292:hover>span,.tbx-1292:focus-visible>span{color:#22253e}.tbx-1292:focus-visible{outline:3px solid #d7a6dd;outline-offset:4px}
@media (prefers-reduced-motion:reduce){.tbx-1292 *,.tbx-1292::before,.tbx-1292::after{animation:none!important;transition:none!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 editorial layouts and headline sections.

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.