JSFiddle - React, Tailwind, and code Playground
by davidpauljunior
HTML
<div class="tooltip">
<p>Tooltip content</p>
</div>
CSS
.tooltip {
background-color: white;
border: 1px solid #888;
padding: 1rem;
margin-top: 1rem;
position: relative;
width: 20rem;
}
.tooltip::before {
content: '';
width: 0;
height: 0;
border-left: 16px solid transparent;
border-right: 16px solid transparent;
border-bottom: 16px solid #aaa;
position: absolute;
top: -16px;
left: 50%;
margin-left: -8px;
}
.tooltip::after {
content: '';
width: 0;
height: 0;
border-left: 14px solid transparent;
border-right: 14px solid transparent;
border-bottom: 14px solid white;
position: absolute;
top: -14px;
left: 50%;
margin-left: -6px;
}
.tooltip p {
margin-top: 0;
}
.tooltip p:last-child {
margin-bottom: 0;
}