Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    89
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Combining Link Attributes

    Hi all..

    this is probably an easy one - =)

    I have a class I'll call
    Code:
    .blue
    I want it to look the same in all states - whether linked, or hovered or what have you....so instead of writing all 4 elements of linkage, can I combine it all?

    thanks in advance!

    carrie

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    628
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Defining only the color for the font, you will probably end up with different colors for, if not all other attributes, at least a:visted. Most web browsers will use their default color for visited links (usually purple) if one hasn't been defined. Four lines would be a lot if you planned on using style="" every time you wanted to make the text blue, but that's why we have stylesheets. Specifying the color for links as well as font will also be sure that the color you want overrides your default attributes, so if you already have a:hover{color: #FFFFFF} you won't have white text when you hover over the link where it's supposed to be blue.
    Code:
    .blue {color: #FF0000;}
    .blue a:link{color: #FF0000;}
    .blue a:visited{color: #FF0000;}
    .blue a:active{color: #FF0000;}
    .blue a:hover{color: #FF0000;}

  • Users who have thanked djh101 for this post:

    intcon (08-02-2010)

  • #3
    New to the CF scene
    Join Date
    Jul 2010
    Location
    Sofia, Bulgaria
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can also combine the rules on single line like that:

    Code:
    .blue, .blue a:link, .blue a:visited, .blue a:active, .blue a:hover{color: #FF0000;}


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •