使用CSS创建工具提示
当用户在文本上移动鼠标光标时,将显示工具提示。您可以在其中添加信息,以使用户易于理解。
示例
您可以尝试运行以下代码以了解如何创建工具提示-
<!DOCTYPE html>
<html>
<style>
#mytooltip #mytext {
visibility: hidden;
width: 100px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 3px;
padding: 10px 0;
position: absolute;
z-index: 1;
}
#mytooltip:hover #mytext {
visibility: visible;
}
</style>
<body>
<div id = "mytooltip">Hover the mouse over me
<p id = "mytext">My Tooltip text</p>
</div>
</body>
</html>