html - html css tooltips on hover event 我可以制作特定的宽度吗?
问题描述
我已经学会了如何做基本的工具提示,但是,我需要为每个工具提示指定一个宽度。我使用的代码来自 w3 学校:
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 500px;
background-color: black;
color: #fff;
text-align: left;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
top: -5px;
left: 0%;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
工具提示文本设置为 500 像素。我需要为每个“跨度”定义一个特定的宽度:
<div class="tooltip">
this is the text to hover
<span class="tooltiptext">
this is the tooltip display
</span>
</div>
我尝试了几种方法来定义宽度(<style="width: 800ps;"> text </style>)
它们都没有奏效。
解决方案
我想通了,它正在工作,我只是忘了禁用缓存。
推荐阅读
- azure-web-app-service - 如何一步一步将两个azure linux虚拟机连接在一起
- typescript - ESLint - 每次导入的“no-unused-vars”警告
- html - css box-shadow 没有隐藏在滚动条上
- php - 重定向视图后会话仍然提交
- sql - 大量警告会导致 SSIS 包失败/取消吗?
- javascript - forEach 循环仅适用于最后一项
- c# - 使用 Levenshtein 距离获取字符串的所有变体
- r - 如何用受特定条件限制的其他字段的最大值/最小值替换字段中的值?允许重复条件
- android - Flutter webRTC | 当用户接到另一个电话并接听该电话时,如何结束通话
- html - 为什么当CSS中的背景是线性渐变时过渡不起作用