Ashwani K
Ashwani K

Reputation: 7990

Give title to background image in HTML

I have one multiple div which have one image in right top corner as background. I want to give some information (like title). Can any body tell how this can be achieved in case of background image.

Thanks, Ashwani

Upvotes: 2

Views: 4618

Answers (2)

FelipeAls
FelipeAls

Reputation: 22171

A background image shouldn't convey any information, thus no need for a title (btw do you mean the title attribute on some element or a heading Hn?).

If you want to add a title, then you should use an img element with a correct alt that IE will incorrectly display as a tooltip. The title attribute should add complementary information, you'd better use the alt attribute alone.

Upvotes: 0

tcooc
tcooc

Reputation: 21209

You have to give the element that has the background image a title.

Something like:

<div style="background-image:url(image.gif);" title="image"></div>

Upvotes: 3

Related Questions