/** * A minimal CSS-only tooltip copied from: * https://codepen.io/mildrenben/pen/rVBrpK * * To use, write HTML like the following: * *

Short

*/ $cubic: cubic-bezier(0.64, 0.09, 0.08, 1); .o-tooltip { position: relative; &:after { opacity: 0; visibility: hidden; position: absolute; content: attr(data-tooltip); padding: 6px; top: 1.4em; left: 50%; transform: translateX(-50%) translateY(-2px); background: grey; font-size: 0.7rem; color: white; white-space: nowrap; z-index: 2; border-radius: 2px; transition: opacity 0.2s $cubic, transform 0.2s $cubic; } &:hover { &:after { display: block; opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); } } } .o-tooltip--left { @extend .o-tooltip; &:after { top: 0; left: 0; transform: translateX(-102%) translateY(0); } &:hover { &:after { transform: translateX(-100%) translateY(0); } } }