从工具提示中隐藏标题 [英] Hide title from tooltip

查看:153
本文介绍了从工具提示中隐藏标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CSS制作工具提示。现在使用以下html代码

I'm making a tooltip using CSS. Now using the following html code

<div title="This is some information for our tooltip." class="progress3">
</div>

和以下CSS

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

.progress3: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;
content: attr(title);
}

.progress3:hover:before{
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}

现在它工作,当我悬停在它上面显示工具提示,显示标题...
如何删除下面图片中橙色圆圈的内容。

Now it works, when I hover over it shows the tooltip, but it also shows the title... How do I remove what's circled in orange in the image below.

推荐答案

通过 title 属性,将其更改为 data-tooltip

Simply don't add the content via the title attribute, change it to something like data-tooltip.

.progress3:hover:after {
    content: attr(data-tooltip);
}

jsFiddle示例

您可以使用JS / jQuery,但是考虑到您所采用的方法,删除它,同时保持功能,因为你将没有什么可以添加通过CSS ..

You could use JS/jQuery, but given the approach you are taking, it is impossible to hide/remove it while keeping functionality as you would then have nothing to add via CSS..

HTML

<div data-tooltip="This is some information for our tooltip." class="progress3">
</div>

CSS

.progress3 {
    position: relative;
    width: 100px;
    height: 100px;
    background: red;
}

.progress3:hover:after {
    background: #333;
    background: rgba(0,0,0,.8);
    border-radius: 5px;
    bottom: 26px;
    color: #fff;
    content: attr(data-tooltip);
    left: 20%;
    padding: 5px 15px;
    position: absolute;
    z-index: 98;
    width: 220px;
}

.progress3:hover:before {
    border: solid;
    border-color: #333 transparent;
    border-width: 6px 6px 0 6px;
    bottom: 20px;
    content: "";
    left: 50%;
    position: absolute;
    z-index: 99;
}

这篇关于从工具提示中隐藏标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆