Code Line Spotlight
The hovered line of a code sample gains emphasis, making technical explanations easier to follow.
The hovered line of a code sample gains emphasis, making technical explanations easier to follow.
Live Demo
Hover over the element or use Tab to focus.
Source Code
Copy the HTML, CSS or JavaScript you need for your project.
<div class="tbx-1096" aria-label="Sample HTML code"><div class="tbx-1096__bar"><span class="tbx-1096__dots" aria-hidden="true">● ● ●</span><strong>index.html</strong><small>HTML</small></div><div class="tbx-1096__source" role="group" aria-label="Individual lines of code"><div class="tbx-1096__line" tabindex="0"><span>01</span><code><main></code></div><div class="tbx-1096__line" tabindex="0"><span>02</span><code> <h1>Hello</h1></code></div><div class="tbx-1096__line" tabindex="0"><span>03</span><code> <p>Welcome</p></code></div><div class="tbx-1096__line" tabindex="0"><span>04</span><code></main></code></div></div></div>
.tbx-1096{width:min(285px,100%);overflow:hidden;border-radius:9px;background:#192a36;color:#d6e2e5;border:1px solid #486373;font-family:system-ui,sans-serif;box-shadow:0 6px 16px #142b3a1b}
.tbx-1096__bar{height:44px;padding:0 12px;display:flex;align-items:center;gap:10px;border-bottom:1px solid #375060;background:#213a4a}.tbx-1096__dots{font-size:10px;letter-spacing:2px;color:#e1a58a}.tbx-1096__bar strong{font-size:11px;font-weight:700}.tbx-1096__bar small{margin-left:auto;font-size:9px;color:#91acb6}
.tbx-1096__source{padding:10px 0 13px}.tbx-1096__line{display:flex;gap:12px;align-items:center;white-space:pre;min-height:28px;padding:5px 12px;position:relative;transition:background .2s,box-shadow .2s}
.tbx-1096__line:before{content:"";position:absolute;top:0;bottom:0;left:0;width:3px;background:#70ceb6;transform:scaleY(0);transition:transform .25s}
.tbx-1096__line>span{flex:0 0 21px;color:#668698;font:11px/1.4 ui-monospace,monospace}.tbx-1096__line code{font:11px/1.4 ui-monospace,monospace;color:#c9e3d1}
.tbx-1096__line:is(:hover,:focus-visible){background:#2f5361;box-shadow:inset 0 0 0 1px #3a6871}.tbx-1096__line:is(:hover,:focus-visible):before{transform:scaleY(1)}.tbx-1096__line:is(:hover,:focus-visible) code{color:#fff}
.tbx-1096__line:focus-visible{outline:2px solid #e6ac72;outline-offset:-2px}@media(prefers-reduced-motion:reduce){.tbx-1096 *,.tbx-1096__line:before{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 documentation sections and tutorial 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.