WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > Repeat class links?

Reply
  Thread Tools Display Modes
Old 6th April 06, 01:07 PM   #1
Jen
WLC Admin
 
Jen's Avatar
 
Join Date: Mar 2006
Posts: 489
Default Repeat class links?

Hi,

Can anyone explain why I have to repeat class before a:link, a:visited etc instead of one class with a:link, a:visited.

Like this:
.name a:link, a:visited {
color: #000;
}

to

.name a:link, .name a:visited {
color: #000;
}

I thought we shouldn't repeat class or id tags, just like <div>

Thanks
Jen is offline   Reply With Quote
Old 6th April 06, 01:44 PM   #2
HelloRicky
WLC Lover
 
Join Date: Mar 2006
Location: Sweden
Posts: 117
Default Re: Repeat class links?

This:

.name a:link, a:visited {
color: #000;
}

are the same as:

.name a:link {
color: #000;
}

a:visited {
color: #000;
}

Get what I mean?
HelloRicky is offline   Reply With Quote
Old 6th April 06, 02:08 PM   #3
this_melancholy
WLC Lover
 
this_melancholy's Avatar
 
Join Date: Apr 2006
Location: Stockholm, Sweden
Posts: 58
Default Re: Repeat class links?

I´ll try to explain what Ricky means, well see, the .name a:link only applies to a:link that is within a element with the class a. However it´s just for the a:link element, wich means the class isn´t global. Something like that.
this_melancholy is offline   Reply With Quote
Old 6th April 06, 05:06 PM   #4
Zikes
WLC Member
 
Join Date: Apr 2006
Location: Missouri, USA
Posts: 12
Default Re: Repeat class links?

".name a:link" targets all links within an element with the "name" class, but "a:visited" targets all visited links. You should remember that a comma in a selector actually turns it into two completely separate selectors that just happen to have the same properties.

To help remember that this distinction exists I recommend coding like this:

Code:
.name a:link,
.name a:visited{
    color: #000;
}
Having each selector on a line of its own will help you see the separation, and spot errors such as that much more quickly
Zikes is offline   Reply With Quote
Old 6th April 06, 05:20 PM   #5
Jen
WLC Admin
 
Jen's Avatar
 
Join Date: Mar 2006
Posts: 489
Default Re: Repeat class links?

Shrug my mistake...

I can see something like this;
.name a:link { blah }
.name a:visited { blah }

instead
.name a:link, a:visited { blah } = bad, I can see a:visited is missing with tag name.

Thanks for your help
Jen is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource Links Jen Graphics & Multimedia 11 9th September 13 02:26 PM
one more question (links for background) missruby CSS 3 10th February 07 09:20 PM
ul list in a class? can't get it... johnnyblotter HTML & XHTML 2 11th December 06 07:33 PM
id and class in 1 div Jen CSS 4 17th September 06 10:51 AM
Making links clickable under PNG transparency? Paperbag CSS 5 16th July 06 10:42 PM


All times are GMT. The time now is 09:16 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyrightę 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.