Forum Moderators: not2easy

Message Too Old, No Replies

Link color class within a Div

Trying to find correct syntax to accomplish this

         

AstonJay32

1:42 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Style sheet
============

#container a:link{
color: red;
}
<!-- not sure if the following is correct? -->
a.greenLink{
color: green;
}
.
.
.
.
Body
======

<div id="container">
<a href="#">This is a red link</a>

// I'd like a green link here....

</div>

What's the correct syntax to accomplish this? I've looked around the internet a few hours and couldn't find anything. I've tried things like a.greenLink, but this doesn't cover the visited, hover and active states. I've tried #container a.greenLink and that doesn't work. I guess I could just create a new Div and nest that within #container, but I don't want to get in the practice of hacking my way around the problem. I'd like to know the proper way to apply link color to a class and be able to use the most specification possible.

Thanks

jessejump

2:21 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



a.greenlink:link {}
a.greenlink:visited {}
etc.

<a class="greenlink">

AstonJay32

3:00 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



well, that didn't work exactly, but it did get me on the right track!

a.greenlinks:link{} - works unless it's nested.

Correct solution to this issue ends up being:

#container a.greenlinks:link{}

Thanks for your help