Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

CSS links

Garrett85Garrett85 Member Posts: 168
I am reading my latest book "HTML & CSS" a spring into series by Molly E. Holzschlag. Why is it when u create a link in CSS u type a:link instead of just typing a{code}. At first I thought this meant it was a class but a class uses a (.), right? And why do you specify the color twice.
The code in my book read as follows.

a {color: orange; text-decoration: none;}
a:link {color: orange;}
a:visited {color: yellow;}
a:hover {color: fuschia;}
a:active {color: red;}

It seems to me that the link was defined as orange on line one and again on line two. Why is that?


Comments

  • zibadianzibadian Member Posts: 6,349
    : I am reading my latest book "HTML & CSS" a spring into series by Molly E. Holzschlag. Why is it when u create a link in CSS u type a:link instead of just typing a{code}. At first I thought this meant it was a class but a class uses a (.), right? And why do you specify the color twice.
    : The code in my book read as follows.
    :
    : a {color: orange; text-decoration: none;}
    : a:link {color: orange;}
    : a:visited {color: yellow;}
    : a:hover {color: fuschia;}
    : a:active {color: red;}
    :
    : It seems to me that the link was defined as orange on line one and again on line two. Why is that?
    :
    :
    The ":" donates a link state. The a:link color is shown by default. If the link has been visited previously, then the a:visited color is shown. If the cursor is above the link, then a:hover is shown. I'm not really sure, when a:active is shown. Certain browsers might not be able to handle the link state, and use the "normal" link formatting instead.
Sign In or Register to comment.