+ Reply to Thread
Results 1 to 4 of 4

Thread: Different Link Classes

  1. #1
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Different Link Classes

    Hey

    How would I have one link one colour, and hover to another then set another link to two completly different colours!!

    Regards,
    Zenax

  2. #2
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Different Link Classes

    Can anyone help me?

  3. #3
    The_Magistrate's Avatar
    The_Magistrate is offline x10 Elder The_Magistrate is an unknown quantity at this point
    Join Date
    May 2005
    Location
    PA
    Posts
    559

    Re: Different Link Classes

    Easiest way to do this is using CSS. Anchors have pseudo classes called hover which allow you to specify what the link looks like when you pass your mouse over it. For example:

    Code:
    <head>
    <style>
    a { /* Specify what we want the default color of *all* our anchors (links) to be */
    color : black;
    }
    
    a#link1:hover { /* Specify what we want the anchor with the id=link1 to look like when we hover over it. */
    color : red;
    }
    
    a#link2:hover { /* Specify what we want the anchor with the id=link2 to look like when we hover over it. */
    color : blue;
    }
    </style>
    </head>
    <body>
    <a href="#" id="link1">My Link #1</a><br/>
    
    <a href="#" id="link2">My Link #2</a>
    </body>
    The above code should work in all modern CSS supporting browsers (IE, Firefox, Safari, Opera...)

    EDIT: You can also specify individual default (non-hover) colors by omitting the ":hover" from the CSS like this:
    Code:
    a#link1 { /* We'll set the default color to the anchor with id=link1 to be an ugly lime color. */
    color : lime;
    }
    Notice that styles cascade (hence, Cascading Style Sheets), so if you put the specific "a#link1" style after the global "a" style, the specific one will override the global for just that instance.
    Last edited by The_Magistrate; 08-03-2006 at 05:15 PM.
    Getting Started | Terms of Service | Paid Hosting | Forum Rules | Free Server Status | Banned Countries

    If I have helped you through one of my posts, please click the
    blue checkbox on the right below my avatar to add to my reputation.

  4. #4
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Different Link Classes

    Thank you Magistrate!
    Regards,
    Zenax

+ Reply to Thread

Similar Threads

  1. Link Exchange
    By Conor in forum Scripts & 3rd Party Apps
    Replies: 117
    Last Post: 12-09-2007, 12:20 PM
  2. Free Software for your Computer
    By Chris S in forum Computers & Technology
    Replies: 48
    Last Post: 04-21-2006, 02:57 PM
  3. Replies: 0
    Last Post: 09-21-2005, 03:49 AM
  4. x10 Advanced Text Link
    By michaelp in forum Free Hosting
    Replies: 8
    Last Post: 08-30-2005, 06:06 AM
  5. Link Exhcange
    By Bryon in forum Off Topic
    Replies: 2
    Last Post: 05-21-2005, 01:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers