JSFiddle - React, Tailwind, and code Playground
by RhinoD
HTML
<div><a data-title="Под c g t rv u y t r e w q подсказка подсказка подсказка подсказка">Наведи на меня</a></div>
<div><a data-title="Подсказка подсказка">Наведи на меня</a></div>
CSS
[data-title]{
position: relative;
display: inline-block;
}
[data-title]::after{
content: attr(data-title);
display: block;
width: auto;
height: auto;
max-width: 150px;
position: absolute;
top: 100%;
left: 0%;
background: #fff;
font-size: 12px;
color: #4a4a4a;
border: 1px solid #adadad;
padding: 0;
border-radius: 6px;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
box-sizing: border-box;
line-height: 1;
font-weight: normal;
text-align: left;
transform: translateX(-9999px);
transition: opacity .4s ease;
opacity: 0;
z-index: -1;
}
[data-title]:hover:after{
transform: translateX(0);
opacity: 1;
z-index: 100000;
transition: z-index .4s ease, opacity .4s ease;
}