SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Numerous Link Colors

    Hi. Is it possibe to have different navigation link colors on my website. Say header links are black and hover color white and then content links on my website color red and hover color blue?

    Hope someone can help.

    Thanks

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Simply set a class on one of the groups of links and then duplicate the CSS entries so that you have one set of styles with the class and one without with the class ones specifying whatever you want to have different from the ones that don't have the class.


    Code:
    a:link, a:visited {color:red;}
    a:hover, a:focus, a:active {color:blue;}
    a.header:link, a.header:visited {color:black;}
    a.header:hover, a.header:focus, a.header:active {color:white;}
    Alternatively you could test for the links being contained in the header to apply the alternate styling but the CSS for that is not supported by older versions of Internet Explorer so it depends on what percentage of your visitors use old versions of IE and whether or not you care if they see all the links in the one colour instead of the header ones being different.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Tags for this Thread

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
  •