TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Glossary Card Reveal

A short glossary card appears when a technical term is hovered within an article.

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-1231"><p class="sentence">A useful interface needs <span class="anchor"><a href="#tb1231">affordance <span aria-hidden="true">↗</span></a><span class="info" role="note"><b>Affordance</b><span>A visual cue that the element is interactive.</span></span></span> to guide users.</p></div>
CSS
.tbx-1231{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-1231 * ,.tbx-1231 *::before,.tbx-1231 *::after{box-sizing:border-box}

.tbx-1231{background:#faf7f0}.tbx-1231 .sentence{font-family:Georgia,serif;font-size:20px;line-height:1.75;max-width:310px;margin:0}.tbx-1231 .anchor{position:relative;display:inline-block}.tbx-1231 .anchor>a{font-weight:750;text-decoration:underline;text-decoration-color:#d59a4b;text-decoration-thickness:3px;text-underline-offset:5px;color:#303e4e}.tbx-1231 .anchor>a>span{font:13px system-ui}.tbx-1231 .info{font:12px/1.5 system-ui,sans-serif;display:flex;flex-direction:column;gap:6px;position:absolute;z-index:3;left:0;bottom:calc(100% + 10px);width:210px;border-left:4px solid #c78c43;background:#fff;color:#273b48;padding:12px;box-shadow:0 8px 20px #29404a22;opacity:0;transform:translateY(8px) scale(.96);pointer-events:none;transition:opacity .25s,transform .3s}.tbx-1231 .info b{font-size:13px}.tbx-1231 .anchor:is(:hover,:focus-within) .info{opacity:1;transform:translateY(0) scale(1)}.tbx-1231 a:focus-visible{outline:2px solid #b27430;outline-offset:5px}

@media(prefers-reduced-motion:reduce){.tbx-1231 *, .tbx-1231 *::before,.tbx-1231 *::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 learning 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.