black better tooltips
by katalin_2003
HTML
<h1>Tooltip test</h1>
<div class="outer">
<p>This is some text to testing <a href="#" class="tooltip"> A link <span><b> Sample tooltip with much longer text</b></span></a> and some more text and some more text and some more text and some <a href="#" class="tooltip">Link <span><b>longer text</b></span></a> more text and some more text and some more text text and some more text and some <a href="#" class="tooltip">link text <span><b> Sample tooltip with much longer text</b></span></a> more text and some more text and some more text</p>
</div>
CSS
.tooltip {
display: inline-block;
position: relative;
}
.tooltip:hover {
text-decoration: none;
}
.tooltip span {
bottom: 24px;
margin: auto;
position: absolute;
display: block;
/* z-index: 98; */
text-align: center;
left: 100%;
margin-left: -50%;
z-index: -1;
}
.tooltip b {
opacity: 0;
background-color: rgba(0, 0, 0, 0.8);
border-radius: 5px;
color: #fff;
display: inline-block;
margin: auto;
padding: 5px 15px;
white-space: nowrap;
z-index: 98;
text-align: center;
position: relative;
left: -50%;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.tooltip b::before {
opacity: 0;
border: solid;
border-color: #111 transparent;
border-width: 6px 6px 0 6px;
bottom: -6px;
content: "";
display: block;
left: 50%;
margin-left: -6px;
position: absolute;
z-index: 99;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.tooltip:hover span {
z-index: 1;
}
.tooltip:hover b {
opacity: 1;
}
.tooltip:hover b::before {
opacity: 1;
}