Helpful Information
 
 
Category: CSS Help
Different link attributes in CSS

I am trying to create different link attributes for different areas on the same page. For example, I have a banner area that is a dark color and the links need to be a lighter color for contrast, but on the main body of the page the background is white, so I want the links to be darker colors. I also want the hover colors to be different on the different types of links. I have tried using different classes of links, but they all seem to default to one or the other. Any suggestions?

I don't know how much you know about CSS but there are three ways of adding a style; link, embed and inline.

Have you tried declaring a site wide style for the majority of links that are in one style using the link style. Using the embedded style tags at the top of each page for varying links on the page and for specific links that are generally unique use inline style.

I don't know whether this will help or you've already tried this but it is a suggestion.

Falcon

My solution would be to encapsulate each different bannerspace into a <DIV CLASS=name></DIV>
or in a <TD CLASS=name></TD> block.

Then in your CSS code you can script:

DIV.name1 A:link, DIV.name1 A:alink, DIV.name1 A:vlink
{ [ property: value ]; }
DIV.name2 A:link, DIV.name2 A:alink, DIV.name2 A:vlink
{ [ property: value ]; }
etc.

or
TD.name1 A:link, TD.name1 A:alink, TD.name1 A:vlink
{ [ property: value ]; }
etc.

Succes,

Peter



[This message has been edited by PAV (edited 12-15-99).]

;) I think this is a bit cleaner.

<!--Reg Content Links-->
a:active { color: #003584; text-decoration: underline}
a:visited { color: #003584; text-decoration: underline}
a:hover { color: #1573FF; text-decoration: underline}
a:link { color: #003584; text-decoration: underline}

<!--Special Links-->
a.link:active { color: #905FB1; text-decoration: none;}
a.link:visited { color: #905FB1; text-decoration: none;}
a.link:hover { color: #57376F; text-decoration: none;}
a.link:link { color: #905FB1; text-decoration: none;}

how to apply a 'Special Link'
<a href="/stay-healthy.php" class="link">Stay Healthy Tips</a>

You just add the class=link to your <a> tag and all is well.

You can even have 100 different link properties for example you could do a whole new batch and swap the .link for .navlink or .dontgettocrazy.

Also if you where to happen to have another style called .nav with out the a. in front its a whole new thing they wont both be used. In fact the only time the above 'special' link will be used is if is called form an <a> tag.

esterpns, please don't post in 6 year old threads.

I might as well mention that :alink and :vlink are not valid psuedo-classes.

Kravvitz

Replay to "esterpns, please don't post in 6 year old threads."

Perhaps in the future you should avoild coming off as a jerk with a know it all attitude while simpley taking a shot at me and not giveing the man his solution. So whats your latest code that does the samething my code will. So Shoot! what is it im listening. :confused:

Kravvitz

Replay to "esterpns, please don't post in 6 year old threads."

Perhaps in the future you should avoild coming off as a jerk with a know it all attitude while simpley taking a shot at me and not giveing the man his solution. So whats your latest code that does the samething my code will. So Shoot! what is it im listening. :confused:

touchy touchy...is it that time of the month!! :D

Kravvitz
Perhaps in the future you should avoild coming off as a jerk with a know it all attitude while simpley taking a shot at me and not giveing the man his solution.

I'm pretty sure the original poster hasn't waited 6 years for an answer, so I have to agree with Krav. there is no point revive such an old thread (if you look closer it is not even from this millennium ;) ).

Sorry i didnt relize it was old that was my second post ever. I thought he was bashing my code saying it was 6year old code but like i said im an ***. Im sorry










privacy (GDPR)