JSFiddle - React, Tailwind, and code Playground
by Harisankaran Parameswaran
August 09, 2014
HTML
<div class='wrapper'>Some long long text blah blah with some <a href='#' data-tooltip='Tooltip'>link</a> inside it.<br/>
Some more text blah blah with some <a href='#' data-tooltip='Long Tooltip'>link</a> inside it</div>
CSS
*{
font-family: Calibri;
}
.wrapper {
margin: 25px;
}
a {
position: relative;
}
a:hover{
text-decoration: none;
}
a::before {
border-left: 5px solid transparent;
border-top: 5px solid #ffe4b5;
border-right: 5px solid transparent;
height: 0px;
width: 0px;
content:'';
top: -2px;
left: 6px;
}
a::after {
content: attr(data-tooltip);
top: -25px; left: -5px;
background: #ffe4b5;
border-radius: 4px;
padding: 2px 6px;
white-space: nowrap;
color: black;
}
a::after, a::before {
position: absolute;
display: none;
}
a:hover::after, a:hover::before {
display: block;
}