JSFiddle - React, Tailwind, and code Playground
HTML
<ul class="sub-menu">
<li id="menu-item-75"><a>a link</a></li>
</ul>
CSS
ul.sub-menu { margin-top:50px;}
ul.sub-menu li a {
position: relative;
text-decoration: none;
}
ul.sub-menu li a:after {
content: attr(data-tooltip);
position: absolute;
bottom: 130%;
left: 20%;
background: #ffcb66;
padding: 5px 15px;
color: black;
-webkit-border-radius: 10px;
-moz-border-radius : 10px;
border-radius : 10px;
white-space: nowrap;
opacity: 0;
/* At time of this creation, only Fx4 doing pseduo transitions */
-webkit-transition: all 0.4s ease;
-moz-transition : all 0.4s ease;
}
ul.sub-menu li a:before {
content: "";
position: absolute;
width: 0;
height: 0;
border-top: 20px solid #ffcb66;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
/* At time of this creation, only Fx4 doing pseduo transitions */
-webkit-transition: all 0.4s ease;
-moz-transition : all 0.4s ease;
opacity: 0;
left: 30%;
bottom: 90%;
}
ul.sub-menu li a:hover:after {
bottom: 100%;
}
ul.sub-menu li a:hover:before {
bottom: 70%;
}
ul.sub-menu li a:hover:after, ul.sub-menu li a:hover:before {
opacity: 1;
}
JavaScript
// set the tooltip content
jQuery('li#menu-item-75 a').attr('data-tooltip', 'w00t');