Click to See Complete Forum and Search --> : Alt tag in css tylesheet??


MattchuB
12-13-2003, 04:48 PM
I have several divs with background urls... Is there a way to have an alt tag in the CSS stylesheet so a description pops up with a mouseover?

pyro
12-13-2003, 04:57 PM
No. And further, the alt attribute is to supply alternate text for images, for non-graphical browsers, or when the image is not available. IE, unfortunatly, seems to think the alt attribute is the title attribute. If you want the little description box, use the title attribute -- that's what it's for.

MattchuB
12-13-2003, 04:59 PM
And the title attribute can be used in the CSS stylesheet? How is it supposed to look?

pyro
12-13-2003, 05:05 PM
Neither attribute are css -- they are HTML attributes.

<div title="foo">blah</div>

<img src="foo.png" width="50" height="50" alt="description of foo.png">

MattchuB
12-13-2003, 05:08 PM
Okay, so it can't be done in just the stylesheet then.

What I want to do is something like this:

div.abc {
background:url(blahblah.jpg) alt="tootiefruitie"
}

Is there a way to do this? I don't want to access the html file at all. I want to be able to do everything from the stylesheet.

pyro
12-13-2003, 05:26 PM
No, you can not set the alt attribute via css.

MattchuB
12-13-2003, 05:27 PM
And there is no way to do anything like that? With a description popup?

pyro
12-13-2003, 05:30 PM
I fail to see why you can not just put it into your markup. :confused:

MattchuB
12-13-2003, 05:42 PM
I could, but I want to put it in the stylesheet. It's not a big deal, I can put it in the markup or just leave it out entirely. Thanks though.

pyro
12-13-2003, 05:49 PM
Sure thing...

Robert Wellock
12-15-2003, 12:34 PM
The answer was yes you could have used CSS to display alternative text (not how you had it though) in most circumstances it is best left to the mark-up and title attribute.

But it is impossible to use the CSS style sheet to do everything, though XSLT is probably the nearest you'll get to that scenario.