Dock tooltip icons
CSS dock tooltip: dark icon tiles lift and grow on hover while a label fades in above. Also opens on keyboard focus. No JavaScript.
Each tile is a button holding an inline SVG icon and a span with the label. The span is positioned above the button with opacity: 0 and a 6px offset, and :hover and :focus-visible fade it in and slide it into place. The same rules lift the button with translateY(-8px) scale(1.1), so keyboard users get the tooltip too. Each button also has an aria-label with the same text, and prefers-reduced-motion removes the transitions.
snippet.html19 lines
<ul class="dti" aria-label="Modules">
<li><button type="button" aria-label="Selling"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h3l2.4 11h10l2-8H7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><circle cx="10" cy="19" r="1.4" fill="currentColor"/><circle cx="17" cy="19" r="1.4" fill="currentColor"/></svg><span>Selling</span></button></li>
<li><button type="button" aria-label="Ordering"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12 12 3h8v8l-9 9z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><circle cx="16" cy="8" r="1.5" fill="currentColor"/></svg><span>Ordering</span></button></li>
<li><button type="button" aria-label="Receiving"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h12l4 4v12H4z M8 4v6h7V4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg><span>Receiving</span></button></li>
<li><button type="button" aria-label="Reports"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 20V10M10 20V4M15 20v-8M20 20V8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg><span>Reports</span></button></li>
</ul>
<style>
.dti { display:flex; gap:.75rem; margin:0; padding:3rem 1rem 0; list-style:none; font-family:Inter,ui-sans-serif,system-ui,"Segoe UI",sans-serif; }
.dti li { position:relative; }
.dti button { width:70px; height:70px; display:grid; place-items:center; border:0; border-radius:16px; background:#141413; color:#9a9a9a; cursor:pointer; box-shadow:inset 0 0 0 1px #2a2a2a, 0 10px 30px rgb(0 0 0 / .6); transition:transform .25s, color .2s, background .2s; }
.dti svg { width:30px; height:30px; }
.dti span { position:absolute; bottom:calc(100% + 10px); left:50%; padding:.45rem .9rem; border-radius:8px; background:#1a1a1a; border:1px solid #2e2e2e; color:#fff; font-size:1rem; white-space:nowrap; opacity:0; transform:translate(-50%,6px); pointer-events:none; transition:opacity .2s, transform .2s; }
.dti button:hover, .dti button:focus-visible { transform:translateY(-8px) scale(1.1); color:#fff; background:#1d1d1c; }
.dti button:hover span, .dti button:focus-visible span { opacity:1; transform:translate(-50%,0); }
.dti button:focus-visible { outline:2px solid #fff; outline-offset:3px; }
@media (max-width:420px) { .dti button { width:56px; height:56px; } .dti { gap:.5rem; } }
@media (prefers-reduced-motion:reduce) { .dti button, .dti span { transition:none; } .dti button:hover { transform:none; } }
</style>