SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Netherlands
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    give all the urls the same style

    Hey guys, everytime I create a class I have to recreate the a:link etc also. Isn't there a way to say that all the links on the whole page have to look the same?

    thanks in advance

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,821
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Hi,

    The link colours should remain unaffected by your classes unless you are specifically targetting them.

    You can set the colour for all links on your page by setting them as follows.
    Code:
    a {color:black;background:white}
    This will set all states of the anchor to the above colurs. If you wish to set the various states then set them in the order:link,visited, hover, active.

    Code:
    a:link {color:black;background:white}
    a:visited {color:red;background:white}
    a:hover {color:white;background:black}
    a:active {color:black;background:blue}
    To target individual links you will need a class (or id)
    Code:
    a.newlink {color:red;background:white}
     
    <a class="newlink" href="#">Red text</a>
    Paul

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,821
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by me
    The link colours should remain unaffected by your classes unless you are specifically targetting them
    Of course the backgrounds and other properties will change with the parent elements properites.

  4. #4
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Netherlands
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Paul, this will give me time to do something else that copying css styles


Bookmarks

Posting Permissions

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