changing hyperlink colours

Discussion in 'PHP' started by Dimension, Feb 3, 2008.

  1. #1
    I have successfully made table rows with alternating colours using PHP but was wondering if there is a way to make hyperlink colours match the rows. I have tried a few methods using PHP which don't seem to work. Is this possible to do?
     
    Dimension, Feb 3, 2008 IP
  2. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    One way might be to create two different classes in your css, like:

    
    a.blueLink:link { color: #0000FF; }
    a.blueLink:visited { color: #0000FF; }
    a.blueLink:hover { color: #0000FF; }
    a.blueLink:active { color: #0000FF; }
    
    a.redLink:link { color: #FF0000; }
    a.redLink:visited { color: #FF0000; }
    a.redLink:hover { color: #FF0000; }
    a.redLink:active { color: #FF0000; }
    
    Code (markup):
    Then in your php when your printing your links add a class to the <a> to set it to the proper color.

    
    <a href="http://google.com/" class="blueLink">A blue link</a>
    <br />
    <a href="http://google.com/" class="redLink">A red link</a>
    
    Code (markup):
     
    ToddMicheau, Feb 3, 2008 IP