如何添加一个等同于unicode字符的“alt”属性(在一个范围内)?

时间:2021-10-02 20:19:11

I am currently working on a yelp-ish SPA that allows users to rate locations on several criteria, one of which is romantic potential. If the location is romantic, a lips/kiss icon is displayed.

我目前正在开发一个yelp-ish SPA,允许用户根据几个标准对位置进行评级,其中一个标准是浪漫潜力。如果位置是浪漫的,则会显示嘴唇/吻图标。

I currently have the unicode character for lips ???? within a span. When my user hovers over the character, I would like to have the text "Romantic" displayed.

我目前在一个跨度内有嘴唇un的unicode角色。当我的用户将鼠标悬停在角色上时,我希望显示“浪漫”文字。

I was hoping I could just add an alt attribute to an html element housing the unicode character, but apparently alt only works on img, input, and area, none of which seem appropriate.

我希望我可以添加一个alt属性到一个容纳unicode字符的html元素,但显然alt只适用于img,输入和区域,其中没有一个看起来合适。

Is there a simple, html solution?

有一个简单的HTML解决方案吗?

1 个解决方案

#1


1  

Is this what you're looking for? Try the demo below.

这是你在找什么?试试下面的演示。

<span title="Romantic">????</span>

More info about the title attribute here.

有关title属性的更多信息,请点击此处

#1


1  

Is this what you're looking for? Try the demo below.

这是你在找什么?试试下面的演示。

<span title="Romantic">????</span>

More info about the title attribute here.

有关title属性的更多信息,请点击此处