Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Selectors Link and User Action Pseudo-Classes

:link pseudo class not work for URL HREF

I was using :link pseudo class for URL HREF. It does not style it. It styles href with HTML file but not with proper URL.

<a href="index.html">Home Page</a>

<a href="http://www.google.com">Google</a>

One set of CSS

:link{
     color: green;
}

Second set of CSS

a:link{
    color: green;
}

Can anyone please tell me why?

Thanks in advance,

Regards from Macedonia

Karthikeyan Palaniswamy

1 Answer

Sreng Hong
Sreng Hong
15,083 Points

Hi Karthikeyan, :link is used to select unvisited links, so when i try your code it appears that Home Page turn to color green, but Google not, because i may have visited Google but not the local one.

Let me know if you need help. Sreng

Great! I understand it now. Many thanks