Forum Moderators: not2easy

Message Too Old, No Replies

Use CSS to define image on certain page?

         

Ian_batten

11:04 am on Aug 29, 2006 (gmt 0)

10+ Year Member



Hello all,
I have a little experience with CSS, however, have come across something I would like a little help with. I am designing a new header for my oscommerce store, and am using tab buttons. What I would like to do, is make it so that, for example, the "gallery" button which is light green, when on /gallery.htm the button is replaced by the same button, but with a DARK green background.

I would like to do this for all the buttons on the browser, and have the CSS, change the image to the darker image button when on different defined pages.

I hope this makes sense!
Any help greatly appreicated,
Thanks in advance,
Ian

dwighty

11:29 am on Aug 29, 2006 (gmt 0)

10+ Year Member



Ian_batten,

One way of doing this is creating a new id for the li property.

e.g.

li a {background-color: lightGreen;} /* Naturally the lightGreen is replaced by the actually color setting */

and

li#current a {background-color: darkGreen;} /* darkGreen replaced by the actually color setting */

I would then use a bit of php so basically saying if a certain page is called then instead of calling <li> we call <li id="current">

Ian_batten

11:52 am on Aug 29, 2006 (gmt 0)

10+ Year Member



Excellent, thanks for your help.
So, would I just put the

li a {background-color: lightGreen;}
li#current a {background-color: darkGreen;}

In the stylesheet.css?

Ian_batten

12:10 pm on Aug 29, 2006 (gmt 0)

10+ Year Member



Ah, here we go, I have found the perfect example. [mantisuk.com...]
You see how the menu tabs at the top change colour to the strip below, when on a defined page?
Is this done is css, or is an asp function?
Thanks again.

ChrisBolton

12:43 am on Aug 31, 2006 (gmt 0)

10+ Year Member



Neither Ian,

This is a Javascript rollover.

Chris.