.tooltip { position: relative; display: inline-block; } .tooltip .content { visibility: hidden; opacity: 0; max-width: 10rem; min-width: 6rem; background-color: rgba(0, 0, 0, 0.6); color: #fff; padding: 0.5rem; border-radius: 6px; overflow-wrap: break-word; text-align: center; transition: opacity 100ms; position: absolute; z-index: 1; top: -1rem; } .tooltip.below .content { top: 2.5rem; left: 0; right: 0; } .tooltip.darker .content { background-color: rgba(0, 0, 0, 0.8); } .tooltip.right .content { left: 120%; } .tooltip.left .content { right: 120%; } .tooltip .content.sm { font-size: 0.8rem; } .tooltip:hover .content, .tooltip:focus .content, .tooltip:focus-within .content { visibility: visible; opacity: 1; }