.tooltip { position: relative; display: inline-block; color: #006080; border-bottom: 1px dashed #006080; } .tooltip .tooltiptext { visibility: hidden; position: absolute; width: 120px; background-color: #555; color: #fff; text-align: center; padding: 5px 4px; border-radius: 6px; z-index: 1; opacity: 0; transition: opacity .6s; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; } .tooltiptext.top { bottom: 125%; left: 50%; margin-left: -60px; } .tooltiptext.top::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } .tooltiptext.right { top: -12px; left: 110%; } .tooltiptext.right::after { content: ""; position: absolute; top: 50%; right: 100%; margin-top: -5px; border-width: 5px; border-style: solid; border-color: transparent #555 transparent transparent; } .tooltiptext.bottom { top: 135%; left: 50%; margin-left: -60px; } .tooltiptext.bottom::after { content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: transparent transparent #555 transparent; } .tooltiptext.left { top: -5px; bottom: auto; right: 110%; } .tooltiptext.left::after { content: ""; position: absolute; top: 50%; left: 100%; margin-top: -5px; border-width: 5px; border-style: solid; border-color: transparent transparent transparent #555; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter