gpt4 book ai didi

html - 从工具提示中隐藏标题

转载 作者:太空狗 更新时间:2023-10-29 13:06:57 27 4
gpt4 key购买 nike

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

<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;
}

现在它可以工作了,当我将鼠标悬停在它上面时会显示工具提示,但它也会显示标题...如何删除下图中橙色圆圈中的内容。

enter image description here

最佳答案

不要通过 title 属性添加内容,将其更改为类似 data-tooltip 的内容。

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

jsFiddle example

您可以使用 JS/jQuery,但考虑到您所采用的方法,不可能在保持功能的同时隐藏/删除它,因为这样您就无法通过 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;
}

关于html - 从工具提示中隐藏标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19746767/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com