Search code examples
htmlcssduplicatestooltip

Duplicate tooltip fix?


Is there anything I can do to remove the default tooltip?

Screenshot:

double tooltip

This is my HTML:

<div class="filter-button"><a href="/category/work/" title="Work" class="tooltip"><img src="/themes/Phyre/css/img/work.png"></a></div>

... and this is my CSS:

.tooltip{
display: inline;
position: relative;
}

.tooltip:hover:after{
background: #6C8095;
border-radius: 5px;
bottom: 76px;
color: #fff;
text-align: center;
text-transform: uppercase;
content: attr(title);
left: 10%;
padding: 5px 10px;
position: absolute;
z-index: 98;
}

.tooltip:hover:before{
border: solid;
border-color: #6C8095 transparent;
border-width: 6px 6px 0 6px;
bottom: 70px;
content: "";
left: 40%;
position: absolute;
z-index: 99;
}

Solution

  • Replace

    title="Work"
    

    with

    data="Work"
    

    and

    content: attr(title);
    

    with

    content: attr(data);