minimum tooltip
HTML
<div class="box">
<span class="tooltip bottom" aria-label="tooltip here">
text hover show tooltip bottom
</span>
</div>
<div class="box">
<span class="tooltip right" aria-label="tooltip here">
text hover show tooltip right
</span>
</div>
<div class="box">
<span class="tooltip left" aria-label="tooltip here">
text hover show tooltip left
</span>
</div>
<div class="box">
<span class="tooltip top" aria-label="tooltip here">
text hover show tooltip top
</span>
</div>
<div class="box">
<div class="relative">
<input type="text" placeholder="input forcus show tooltip" aria-describedby="input-tooltip">
<div role="tooltip" class="tooltip bottom" id="input-tooltip">tooltip fot form</div>
</div>
</div>
CSS
.box
{
margin-bottom: 50px;
padding-bottom: 50px;
padding-left: 150px;
border-bottom: 1px solid #eee;
}
input
{
width: 200px;
height: 1em;
padding: 6px 8px;
border: 1px solid #eee;
border-radius: 3px;
}
.relative
{
position: relative;
}
/* tooltip */
.tooltip
{
position: relative;
}
.tooltip:after
{
position: absolute;
z-index: 9999;
display: none;
padding: 5px 8px;
content: attr(aria-label);
text-align: center;
white-space: pre;
text-decoration: none;
letter-spacing: normal;
text-transform: none;
word-wrap: break-word;
opacity: 0;
color: #fff;
border-radius: 3px;
background: rgba(0, 0, 0, .8);
background-color: #333;
text-shadow: none;
font-smoothing: subpixel-antialiased;
}
.tooltip:before
{
position: absolute;
z-index: 10000;
display: none;
width: 0;
height: 0;
content: '';
opacity: 0;
color: #333;
color: rgba(0, 0, 0, .8);
border: 5px solid transparent;
}
.tooltip:hover:before,
.tooltip:hover:after,
.tooltip:active:before,
.tooltip:active:after,
.tooltip:focus:before,
.tooltip:focus:after
{
display: inline-block;
-webkit-animation-name: fadein;
animation-name: fadein;
-webkit-animation-duration: .4s;
animation-duration: .4s;
text-decoration: none;
opacity: 1;
}
/* tooltip position */
.tooltip.bottom:after,
.tooltip.bottom-right:after,
.tooltip.bottom-left:after
{
top: 100%;
right: 50%;
margin-top: 4px;
}
.tooltip.bottom:before,
.tooltip.bottom-left:before,
.tooltip.bottom-right:before
{
top: auto;
right: 50%;
bottom: -4px;
margin-right: -5px;
border-bottom-color: rgba(0, 0, 0, .8);
}
.tooltip.bottom:after
{
right: 0;
left: 0;
}
.tooltip.bottom-right:after
{
right: auto;
left: 50%;
margin-left: -15px;
}
.tooltip.bottom-left:after
{
margin-right:...