Previous Message
Next Message

CSS equivalent of <img> "src"attribute?

Sent by Marcello Mastroianni on 26 October 2006 17:05


> image with a red cross is also surimposed.

Do you mean you're getting a broken image icon? If that's the case you can use a transparent image
like this:

<img src="images/transparent_shim.gif" id="replace" alt="replaced image" title="replaced image" />

And in the stylesheet you can call to the background image like this:

img#replace { background:url(images/replace.jpg); width:100px; height:25px; }

Keep in mind that the alt tags should still describe the image that's used as the background image,
so that would still need to be updated (dynamically or otherwise).

-- Marcello



Fred Janon [EMAIL-REMOVED]> wrote: I am creating dynamically an  element in Javascript. I set the
"src" attribute to a default image file path i.e.
'src="images/defaulticon.jpg"' and I would like to be able to override
that path using CSS. I checked my CSS books and the list previous posts
and could not find anything. I tried img {background:
url('images/myicon.jpg') and got the image in the background but the
image with a red cross is also surimposed.

Basically I would like to see the myicon.jpg and not defaulticon.jpg in
a configuration like this:

    img {
    src: url("images/calendar.gif");
    }


id="calendarContainer_Icon">

Thanks

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: