在光标下显示文本 [英] Display text under cursor

查看:76
本文介绍了在光标下显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鼠标指针放在一个元素上,我想显示一些文本。例如,如果您将光标置于答案的最后,它会显示此答案很有用。你可以在下面的图片中看到它。我甚至不知道如何搜索这些内容。



解决方案

添加 title 属性。这是在上面的图像中完成的。

 < a class =vote-up-offtitle =This answer is有用。>投票< / a> 






如果您想要自定义工具提示,请参阅这个答案。您基本上会使用伪元素和自定义 data - * 属性的组合。为了访问<$ c c> attr(data-tooltip),你会给伪元素一个 content 例如$ c> data-tooltip 属性。


Whe mouse pointer placed on an element I want to show some text. For example if you place your cursor on upvote of an answer, it shows "This answer is useful". You can see it in below image. I did't even know how to search this.

解决方案

Add a title attribute to the element. That's what's done in the image above.

<a class="vote-up-off" title="This answer is useful.">up vote</a>


If you want a custom tooltip, see this answer. You would basically use a combination of pseudo elements and custom data-* attributes. You would give the pseudo elements a content value of attr(data-tooltip) in order to access the data-tooltip attribute, for instance.

这篇关于在光标下显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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