如何调用“工具提示"将鼠标悬停在浏览器中的ID& #HTML元素上时? [英] How to invoke a "tooltip" when hovering over ID'd HTML elements in a Browser?

查看:46
本文介绍了如何调用“工具提示"将鼠标悬停在浏览器中的ID& #HTML元素上时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这样的CSS,正在开发一个版本的"Huck Finn",该版本以不同的颜色显示对话框,具体取决于扬声器(Huckleberry为紫色,Pap为棕色),

I am working on a version of "Huck Finn" that displays dialog in different colors, depending on the speaker (purple for Huckleberry, brown for his Pap, etc.) by using CSS like so

#huck {
    color: purple;
}

...和这样的HTML:

...and HTML like this:

<p><span id="huck">"But some says he got out and got away, and come to America."</span></p>

可以在此处

我有一个字符映射",显示哪个字符是文档开头附近的哪种颜色,但是我意识到许多读者会忘记哪种颜色代表哪个字符,而不是强迫他们一直回到起点.关于文档以提醒自己,我希望允许他们将鼠标悬停在彩色文本上,并在弹出窗口"或工具提示"中查看或查看您的身份,这是什么.因此,如果他们将鼠标悬停在上面的句子("But"和"America"之间的任意位置),他们会看到类似"Huck在说话"的内容.

I have a "character mapping" showing which character is which color near the start of the doc, but I realize many readers would forget which color represents which character and, rather than forcing them to go all the way back to the start of the doc to remind themselves, I would like to allow them to hover over the colored text and see in a "popup window" or "tooltip" or what have you, who it is. So if they were to hover over the sentence above (anywhere between "But" and "America") they would see see something like "Huck is speaking".

这可能吗?如果是这样,怎么办?

Is this possible? If so, how?

推荐答案

在段落标记上建议标题属性

Suggesting title attribute over the paragraph tag

<p><span id="huck" title="Huck is speaking">"But some says he got out and got away, and come to America."</span></p>

这篇关于如何调用“工具提示"将鼠标悬停在浏览器中的ID&amp; #HTML元素上时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆