如何添加等同于 unicode 字符的 "alt" 属性(在一个范围内)?
How to add an "alt" attribute equivalent to a unicode character (in a span)?
我目前正在开发一个 yelp-ish SPA,它允许用户根据多个标准对位置进行评级,其中之一是浪漫潜力。如果位置浪漫,则会显示 lips/kiss 图标。
我目前在 span
中有嘴唇 </code> 的 unicode 字符。当我的用户将鼠标悬停在角色上时,我希望显示文本 "Romantic"。</p>
<p>我希望我可以将 <code>alt
属性添加到包含 unicode 字符的 html 元素,但显然 alt
仅适用于 img
,input
,和 area
,其中 none 似乎是合适的。
是否有简单的 html 解决方案?
这是您要找的吗?试试下面的演示。
<span title="Romantic"></span>
有关 title
属性的更多信息 here。
我目前正在开发一个 yelp-ish SPA,它允许用户根据多个标准对位置进行评级,其中之一是浪漫潜力。如果位置浪漫,则会显示 lips/kiss 图标。
我目前在 span
中有嘴唇 </code> 的 unicode 字符。当我的用户将鼠标悬停在角色上时,我希望显示文本 "Romantic"。</p>
<p>我希望我可以将 <code>alt
属性添加到包含 unicode 字符的 html 元素,但显然 alt
仅适用于 img
,input
,和 area
,其中 none 似乎是合适的。
是否有简单的 html 解决方案?
这是您要找的吗?试试下面的演示。
<span title="Romantic"></span>
有关 title
属性的更多信息 here。