PDA

View Full Version : defining images, NOT background..but usine css to actually call an image...


BrightNail
08-29-2003, 10:30 PM
Is there a way to call an image using CSS.
I have a dynamic site that deals with branding..and rather than put a bunch of IF ELSE statements around images...based on branding...I can just include a style sheet based on branding that will handle all the style classes in the pages..

for instance.

<td><style class="image_header1"></td>

this way, this call remains the same...except that I call in a diff. style sheet that defines ..."image_header1" differently depending on which brand....brandA might call a graphic that looks one way, brandB calls another graphic that looks another way....but the call stays the same...and I just have to create new brand css files to show branding..

thanks.

krycek
08-29-2003, 10:55 PM
use a DIV and define the image as a background:

#myDiv {
background: url("bg.gif");
}

or else apply the id/class directly to the table cell and bypass using the DIV. :)

::] krycek [::

BrightNail
09-01-2003, 05:35 AM
cool...so instead of using style tags, I use div tags?...now, what browsers support this as it has to be mostly univeral?

I appreciate your comments

MotherNatrsSon
09-01-2003, 05:55 AM
Originally posted by BrightNail
cool...so instead of using style tags, I use div tags?...now, what browsers support this as it has to be mostly univeral?

I appreciate your comments

No. you apply styles to the div tags.

What krycek posted is a style for a div. He used "shorthand" CSS. The "long" way is:

#myDiv {
background-image: url("bg.gif");
}

According to the CSS2 Reference (http://www.w3schools.com/css/css_reference.asp#background), the "long" version has more browser support.

MNS