TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Correction Line Swap

A crossed-out editorial term gives way to a corrected headline on hover.

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-1232"><a class="edit" href="#tb1232"><span class="eyebrow">WHAT WE VALUE</span><span class="line"><span class="old">More complexity.</span><span class="new">More clarity.</span></span><span class="marker">EDITED THINKING <b aria-hidden="true">↗</b></span></a></div>
CSS
.tbx-1232{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-1232 * ,.tbx-1232 *::before,.tbx-1232 *::after{box-sizing:border-box}

.tbx-1232{background:#e9e7e2}.tbx-1232 .edit{color:#2d3440;width:min(100%,285px);text-decoration:none;border-bottom:2px solid #9a9b95;padding:12px 4px 14px;display:grid;gap:15px}.tbx-1232 .eyebrow{font:750 10px system-ui;letter-spacing:.2em;color:#6d746d}.tbx-1232 .line{display:block;height:37px;overflow:hidden;position:relative;font:700 27px Georgia,serif;white-space:nowrap}.tbx-1232 .old,.tbx-1232 .new{position:absolute;left:0;top:0;transition:transform .42s,opacity .3s}.tbx-1232 .old{text-decoration:line-through;text-decoration-color:#c46a45;text-decoration-thickness:2px;text-decoration-skip-ink:none}.tbx-1232 .new{opacity:0;transform:translateY(32px);color:#30594f}.tbx-1232 .marker{font:700 9px system-ui;letter-spacing:.15em;color:#737c72;display:flex;justify-content:space-between}.tbx-1232 .edit:is(:hover,:focus-visible) .old{opacity:0;transform:translateY(-35px)}.tbx-1232 .edit:is(:hover,:focus-visible) .new{opacity:1;transform:translateY(0)}.tbx-1232 .edit:focus-visible{outline:2px solid #30594f;outline-offset:6px}

@media(prefers-reduced-motion:reduce){.tbx-1232 *, .tbx-1232 *::before,.tbx-1232 *::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 articles and portfolio galleries.

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.