作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想要在鼠标悬停时在我的应用程序中显示工具提示。我尝试了很多 bt 没有得到任何结果 我在我的 css 中遗漏了一些东西 HTML.,
<div style="text-align: center;">
<p>
<a href="#" data-tooltip="left tooltip" data-placement="left">left tooltip</a>
</p>
</div>
有人说出解决方案
CSS:
body {
margin: 20px;
}
a[data-tooltip] {
position: relative;
}
a[data-tooltip]::before,
a[data-tooltip]::after {
position: absolute;
display: none;
opacity: 0.85;
}
a[data-tooltip]::before {
/*
* using data-tooltip instead of title so we
* don't have the real tooltip overlapping
*/
content: attr(data-tooltip);
background: #000;
color: #fff;
font-size: 13px;
padding: 5px;
border-radius: 5px;
/* we don't want the text to wrap */
white-space: nowrap;
text-decoration: none;
}
a[data-tooltip][data-placement="left"]::before {
top: -25%;
right: 100%;
margin-right: 10px;
}
我希望我的应用程序在鼠标悬停时有一个工具提示。我尝试了很多但没有得到任何结果
最佳答案
您的 CSS 中缺少 2 个元素(请参阅以下 CSS 代码中的注释):
CSS:
a[data-tooltip]:hover::before { /* <- added :hover so it displays only on hover state */
content: attr(data-tooltip);
background: #000;
color: #fff;
font-size: 13px;
padding: 5px;
border-radius: 5px;
white-space: nowrap;
text-decoration: none;
display:block; /* <-- this line */
}
关于html - 如何在文本或文本字段的左侧显示工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24885243/
我想开发一个 Skype 机器人,它将用户名作为输入,并根据用户输入以相反的字符大小写表示hello username。简而言之,如果用户输入他的名字 james,我的机器人会回复他为 Hello J
我是一名优秀的程序员,十分优秀!