Jump to content

How can I controll images with CSS?


bobleny

Recommended Posts

Oh, I'm sorry, when I said change I ment I want the ability to change it. I just want to use css to display it.

I want to have to diffrent CSS files so If I use the first one, the top image is header.gif, but if I use the second file, I want the top image to be header2.gif.

Do you understand?
Link to comment
Share on other sites

The only way for CSS to display an image is by using the background-image style attribute. There is no other CSS attributes that can display an image AFAIK.

This is probably not a good idea to have but what you could do is have two image tags where one displays header1.gif and other displays header2.gif. Give them class names of header1 and header2

Now in the stylesheet you want to display header1.gif add this to it:
[code].header1 {
    display: block; /* this shows the image for header1 */
}
.header2 {
    display: none;  /*this stops the header2 image from displaying */
}[/code]
For the style you want to display header2.gif you use this:
[code].header1 {
    display: none; /*this stops the header1 image from displaying */
}
.header2 {
    display: block; /* this shows the image for header2 */
}[/code]
That way when the user switches stylesheet a different image will be shown for each style.

However using the background-image attribute is probably better.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.