Html 如何在鼠标悬停时显示工具提示或项目信息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2992018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how can I display tooltip or item information on mouse over?
提问by nectar
I am displaying 5 userImage
on one screen.I want to display userID
and email
on mouseover
on those userImage.I used alt
property of image control but that not working in mozila,chrome and some versions of IE.
So what are the other better ways to display info on mouseover?
我userImage
在一个屏幕上显示 5。我想在那些 userImage上显示userID
和 显示。我使用了图像控件的属性,但在 mozila、chrome 和某些版本的 IE 中不起作用。那么在鼠标悬停时显示信息的其他更好方法是什么?email
mouseover
alt
回答by adrianbanks
The simplest way to get tooltips in most browsers is to set some text in the title attribute.
在大多数浏览器中获取工具提示的最简单方法是在title 属性中设置一些文本。
eg.
例如。
<img src="myimage.jpg" alt="a cat" title="My cat sat on a table" />
produces (hover your mouse over the image):
产生(将鼠标悬停在图像上):
a cat http://www.imagechicken.com/uploads/1275939952008633500.jpg
一只猫 http://www.imagechicken.com/uploads/1275939952008633500.jpg
Title attributes can be applied to most HTML elements.
标题属性可以应用于大多数 HTML 元素。
回答by Asaph
The title
attributeworks on most HTML tags and is widely supported by modern browsers.
该title
属性适用于大多数 HTML 标签,并得到现代浏览器的广泛支持。