2 replies [Last post]
bryantms
Offline
newbie
Last seen: 13 years 43 weeks ago
Joined: 2007-07-12
Posts: 3
Points: 0

I'm putting up a verticle nav bar and have a little CSS to change the background and add an image for a visited link. Here's the setup

body#feature a#featureLink { background: #FFFFFF url(images/bg_here.png) no-repeat 95% 50%; padding-right: 15px; padding-left: 30px; font-weight: bold; }

That part works. I simply add an ID tag to the body and link on each page.

My question is, do I have to duplicate that for each page, or can I do this:

body#home a#homeLink body#feature a#featureLink body#expert a#expertLink body#quiz a#quizLink body#project a#projectLink body#horoscope a#horoscopeLink { background: #FFFFFF url(images/bg_here.png) no-repeat 95% 50%; padding-right: 15px; padding-left: 30px; font-weight: bold; }

I can't get this to work at all. I'm just trying to find out for the future if I can include multiple selectors like this.

Thanks for your help!

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 8 weeks 7 hours ago
Joined: 2004-06-30
Posts: 9674
Points: 810

You can, you just need to

You can, you just need to separate them with commas:

body#home a#homeLink, body#feature a#featureLink, body#expert a#expertLink, body#quiz a#quizLink, body#project a#projectLink, body#horoscope a#horoscopeLink { background: #FFFFFF url(images/bg_here.png) no-repeat 95% 50%; padding-right: 15px; padding-left: 30px; font-weight: bold; }

note the last one specifically DOESN'T need a comma at the end, it breaks if you have one Wink

Verschwindende wrote:
  • CSS doesn't make pies

bryantms
Offline
newbie
Last seen: 13 years 43 weeks ago
Joined: 2007-07-12
Posts: 3
Points: 0

Thanks!

Wow, thanks! Everything's working just fine now.

I'm a little surprised because I'm working from CSS: The Missing Manual and it didn't mention anything like that. The example they use has no commas.