Is there a solution for adding a title attribute to the image that is displayed as a background image for div tag. The current code is like
<div style="background:transparent url(image/smiley.jpg) left bottom; cursor:pointer;">
I would like to add a title attribute “Smiley” to the background image smiley.jpg
You can put a
titleattribute on thediv. Since thebackground-imagerepeats by default, it will fill thediv.But assume for a moment that the image was set to
no-repeatand was smaller than thedivitself. In that case, you could not (without JavaScript) display a tooltip only when the cursor is over thebackground-image.