using CSS in links

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
struggling_student
Forum Newbie
Posts: 15
Joined: Mon Feb 23, 2004 3:51 pm

using CSS in links

Post by struggling_student »

Hi everyone - I have a problem concerning the use of CSS in PHP links. I have set up the following:

<head>
<style>
A.Link:link { color: blue; text-decoration: none;}
A.Link:visited { color: #000080; text-decoration: none;}
A.Link:hover { color: black;}
A.Link:active { color: #000080;}
</style>
</head>


and am trying to use it in

echo '<a href="databases.php?database='.$db.'" class="Link">';
echo $db;
echo '</a><br>';

although the link does change colour when the cursor hovers over it, the link is still underlined when it's displayed on the page when I've clearly stated that it shouldn't be.

However, if I try to use the css class in basic html it works perfectly. Can anyone help me with this problem? Obviously I need to use it within PHP as I'm calling PHP variables within it but it doesnt seem to be working with me!!!

Thanks in advance!!
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

If tested with IE only try testing it with Opera or Mozilla.

Try this :

a{ color: blue; text-decoration: none;}
a:visited { color: #000080; text-decoration: none;}
a:hover { color: black;}
a:active { color: #000080;}
struggling_student
Forum Newbie
Posts: 15
Joined: Mon Feb 23, 2004 3:51 pm

Post by struggling_student »

Excellent.... thanks!!!
Post Reply