Forum Moderators: not2easy

Message Too Old, No Replies

how to specify 2 different link colours?

         

marcus76

9:13 am on Mar 15, 2005 (gmt 0)

10+ Year Member



Hi,

I use an external stylesheet which contains the following:

A {
color: #ffffff;
text-decoration: none;
}

I then have my mainpage.php, which contains HTML and the following onpage styles.

A {
color: #000000;
text-decoration: none;
}

I notice however that all the links are white (#ffffff). Can someone please advise how i can enforce for a particular link the colour balck (#000000)?

Many thanks

Marcus

benihana

9:17 am on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



lots of ways to do this, involving ID's and classes.

You could add an id to the body tag on mainpage.php:

<body id="mainpage">

then change your CSS to:

A {
color: #ffffff;
text-decoration: none;
}

#mainpage A {
color: #000000;
text-decoration: none;
}

<added> Just noticed you have the black links as onpage styles. Are these referenced after you call your stylesheet in the <head> section? </added>

marcus76

10:28 am on Mar 15, 2005 (gmt 0)

10+ Year Member



hey Benihana,

Yes, the black links are referenced after i call the stylesheet in the <head> section.

Cheers

Marcus

benihana

10:54 am on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try setting out the full selectors for the black links, e.g.:

a:link, a:visited {
color:#000;
text-decoration:none;
}

marcus76

11:11 am on Mar 15, 2005 (gmt 0)

10+ Year Member



Benihama, you the man, worked a treat.

many thanks for your help.

Marcus

;-)