CSS - how to prevent the original title information from being displayed
I am using the following simple html code -
<html lang="en">
<head></head>
<body>
<a href="#" title="This is some information for our tooltip." class="tooltip">
<span>CSS3 Tooltip</span>
</a>
</body>
</html>
And I also added some CSS rules to make a nice hint when the mouse hovers over the link
.tooltip {
display: inline;
position: relative;
}
.tooltip:hover:after{
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(title);
left: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
}
.tooltip:hover:before {
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}
The thing is, now I am getting the tooltip, but also the original popup name -
Is there a way to make a white prompt? and only with a css rule?
Thanks for any help
+3
source to share
2 answers
Use the attribute instead data-*
.
.tooltip {
display: inline;
position: relative;
top: 50px;
}
.tooltip:hover:after {
background: #333;
background: rgba(0, 0, 0, .8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(data-title);
left: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
}
.tooltip:hover:before {
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}
<a href="#" data-title="This is some information for our tooltip." class="tooltip"><span>CSS3 Tooltip</span></a>
+3
source to share