Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To Show an tooltip on Image in Mvc3

I'm using asp.net MVC3 and i want to show a table containing information about a course In that i have a field called "Information" which show an image. I want to show the a tooltip when the mouse is taken on that image

I'm showing image lik this:

<img id="ok" src="../../Images/info.jpg" alt="tooltip"/>

I dont want to use any added plugin

can anybody help me with this?

like image 731
MVC_Nhibernate Avatar asked Dec 12 '22 02:12

MVC_Nhibernate


2 Answers

Use title as well as alt in the Html tag

<img id="ok" src="../../Images/info.jpg" title="This is your tooltip message"/>
like image 60
CD Smith Avatar answered Feb 24 '23 18:02

CD Smith


alt attributes on img elements are used as alternate text in case the image does not exist. Some browsers display these as tool tips when hovering over the image, but its not standard.

You could use the title attribute to display a tool tip on hover of the image.

You should always provide an alt attribute when using images, this is best for accessibility (screen readers read the alt text), and will fail XHTML if you don't have the attribute.

like image 24
Curtis Avatar answered Feb 24 '23 18:02

Curtis