tags:

views:

108

answers:

4

What is the differences between a {...} and a:link{...} ? what are different usage of both ? How we can take benefit of both tag?

+6  A: 

a covers all the bases. a:link is used only if the link in un-visited, un-hovered, and in-active.

So, use a for things like font-family (if you want links to come up in a different font), then use link for the standard formatting, and visited, hover and active for 'special effects'.

EDIT: After reading Sander's W3C link, I can see that I didn't have it quite right. a:link will cascade down to a:hover and a:active, i.e. anything in a:link that is not over-ridden by the dynamic pseudo-classes will also apply to them.

Skilldrick
Hmm interesting edit, I didn't catch that one to be honest :-)
Sander Rijken
+1  A: 

a:link only affects links that have a href attribute basically (if a:visited, a:hover or a:active does not apply)... The main case where I've noticed a difference is that a:link doesn't affect Named Anchors whereas a will. Also, a is the default style if none of the other pseudo classes are defiend.

<a name="Section1">Section 1</a>
Shawn Steward
Actually, a named anchor is visible (provided it has content).
brianary
Yeah, <a name="Section1">Section 1</a> is an example of where a:link will not affect the style.
Shawn Steward
Woops, I accidentally removed that one. Yeah I agree that they can have content, and you could use css on `a` to change the style. It's not true thought that everything with an href is affected by `a:link`
Sander Rijken
Yeah I guess I phrased that wrong. a:link will not affect anchors that don't have a href I should say.
Shawn Steward
+1  A: 

Here is a decent resource:

http://www.w3schools.com/CSS/css%5Fpseudo%5Fclasses.asp

ScottE
+6  A: 

According to W3C a:link is for not visited, a:visited is for visited, and just a applies to both.

Sander Rijken
You're spot on. I don't know why this wasn't marked as answered already.
baeltazor