本文介绍了如何向span元素添加工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的代码中,我想要一个工具提示,当用户悬停跨度时,我该怎么做?我不想使用任何链接。
In the following code, I want a tool-tip to come up when the user hovers the span, how do I do that? I don't want to use any links.
<span> text </span>
推荐答案
以下是简单的内置方法:
Here's the simple, built-in way:
<span title="My tip">text</span>
这会给你纯文本工具提示。如果你想要丰富的工具提示,使用格式化的HTML,你需要使用库来做到这一点。幸运的是,有很多。
That gives you plain text tooltips. If you want rich tooltips, with formatted HTML in them, you'll need to use a library to do that. Fortunately there are loads of those.
这篇关于如何向span元素添加工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!