MVC_Nhibernate
MVC_Nhibernate

Reputation: 457

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?

Upvotes: 4

Views: 7711

Answers (2)

CD Smith
CD Smith

Reputation: 6607

Use title as well as alt in the Html tag

<img id="ok" src="../../Images/info.jpg" title="This is your tooltip message"/>

Upvotes: 9

Curtis
Curtis

Reputation: 103348

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.

Upvotes: 4

Related Questions