Click to See Complete Forum and Search --> : Want to change colour of SOME links, not all


LisaP
06-26-2008, 08:05 AM
Hi everyone. I'm using Dreamweaver 8. I set up my css style in 'page properties'. But now I want to change the colour of some of my links on the page, (from white to grey) but when I do, the link colour defaults to the one defined in my css (white). I have attached new style sheets, but when creating them they don't have a:link ids, so I have copied a:link ids from my main style sheet to my new one, and then changed the a:link to grey - whereupon all the links turn grey! Am tearing my hair out! Please help! Lisa.

dtm32236
06-26-2008, 10:27 AM
if i understand this correctly, you can just use classes...

CSS:
a {color:#fff;}
a:hover {color:#ccc;}

a.grey {color:#666;}
a.grey:hover {color:#333;}


HTML:
<a href="test1.html">a white link</a>

<a href="test2.html" class="grey">a grey link</a>

LisaP
06-26-2008, 12:22 PM
Thanks for replying. I've just spent another hour on it and I still can't make it work. Here's my code:

<link href="file:///C|/Documents and Settings/alekos/My Documents/testlink/redlink.css" rel="stylesheet" type="text/css" />
<link href="file:///C|/Documents and Settings/alekos/My Documents/testlink/greenlink.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p><a href="A1VA_Websites2_Design.html">linky link link
</a>
</p>
<p>&nbsp;</p>
<p><a href="A1VA_Websites2.html">linky link link too </a></p>
</body>
</html>

I think the css files are in the 'head' and shouldn't be there, but I don't know where they should be. Now when I highlight the text to create the link, in the properties inspector it says 'Style: None' and won't change. Many thanks, Lisa

dtm32236
06-26-2008, 03:03 PM
the sylesheets should be in the head, you have it right.

what's in the redlink.css and greenlink.css?

really, you should only have one stylesheet. Then in your one stylesheet, you could do:

a.redlink {color:#f00;}
a.redlink:hover {color:#c00;}
a.greenlink {color:#0f0;}
a.greenlink:hover {color:#0c0;}

then you could do

<p><a href="A1VA_Websites2_Design.html" class="redlink">this link is red</a></p>
<p>&nbsp;</p>
<p><a href="A1VA_Websites2.html" class="greenlink">and this one is green</a></p>

LisaP
06-27-2008, 04:11 AM
Dear dtm

Thanks so much. After struggling with it for 4 hours yesterday, it's just taken 5 minutes to fix! Thanks and kindest regards from sunny Greece, Lisa

dtm32236
06-27-2008, 09:07 AM
No problem. Glad it worked out!