1. Assign class to each link 2. Assign class to each div Example for 1: Markup: <div><!-- First div --> <a class="link-type-a" href="#">Click Here</a> </div> <div><!-- Second div --> <a class="link-type-b" href="#">Click Here</a> </div> Code (markup): CSS: a .link-type-a{color:#ff0000} a .link-type-b{color:#00000} Code (markup): Example for 2: Markup: <div class="link-type-a"><!-- First div --> <a href="#">Click Here</a> </div> <div class="link-type-b" ><!-- Second div --> <a href="#">Click Here</a> </div> Code (markup): CSS: .link-type-a a{color:#ff0000} .link-type-b a{color:#00000} Code (markup): Advantage 2 over 1 is, if there are more than 1 links, all links in specified within a div will have the specific color rather assigning class each time for each number of links.
Assign different class of CSS to different div and in this way you can easily change the colors of links in div.
That was like the WROST example ever. The way you do it in a declared div class or id... #whatever a:link, #whatever a:visited, #whatever a:hover { [B] color: #DDDDDD; text-decoration: none; [/B] } Code (markup): Change everything you want inside the bold writing and change the "whatever" to what you want.
Don't forget to refer to your div class in your HTML like thus: <DIV CLASS="whatever">content and links here</DIV>
You could set different class for each divs, then assign the a child ( include the pseudo if you will ) for colors, but that would be bad practice since it'll slow down the css rendering. Also it'll get quite complicated if you're working on a huge site/web-apps. Better option is to define different classes for each a you want to style. check this for reference for best efficient css : https://developer.mozilla.org/en/Writing_Efficient_CSS