PRACTICAL WEB TIP
Citation Margin Capsule
A citation summary expands sideways from a compact footnote in the article margin.
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-1220"><p class="tbx-1220-paragraph">Readable interfaces are built from <span class="tbx-1220-anchor" tabindex="0" role="note" aria-label="Reference 03: Usability research">small decisions <sup>[03]</sup><span class="tbx-1220-note">REFERENCE 03 <strong>Usability research</strong></span></span> made with care.</p></div>
CSS
.tbx-1220{box-sizing:border-box;max-width:100%;overflow:visible}
.tbx-1220{display:grid;place-items:center;width:100%;min-height:200px;padding:25px 19px;background:#f0f2f4;font-family:Georgia,serif}.tbx-1220 *{box-sizing:border-box}.tbx-1220-paragraph{width:min(100%,310px);margin:0;color:#303940;font-size:19px;line-height:1.65}.tbx-1220-anchor{position:relative;display:inline;color:#244b7d;cursor:help;border-bottom:1px dotted #244b7d;outline-offset:2px}.tbx-1220-anchor sup{font-family:Arial,sans-serif;font-size:9px;white-space:nowrap}.tbx-1220-note{position:absolute;z-index:2;bottom:calc(100% + 6px);left:0;width:0;max-width:calc(100vw - 90px);overflow:hidden;white-space:nowrap;border-radius:4px;background:#244b7d;color:white;font:9px/1.5 Arial,sans-serif;letter-spacing:.08em;opacity:0;padding:0;transform:translateY(7px);transition:width .35s,opacity .25s,transform .35s,padding .35s}.tbx-1220-note strong{display:block;font-size:12px;letter-spacing:0}.tbx-1220-anchor:is(:hover,:focus-visible) .tbx-1220-note{width:166px;padding:8px 12px;opacity:1;transform:translateY(0)}.tbx-1220-anchor:focus-visible{outline:2px solid #244b7d}
@media(prefers-reduced-motion:reduce){.tbx-1220 *, .tbx-1220 *::before,.tbx-1220 *::after{transition:none !important;animation: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 articles and blogs and documentation 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.