Wednesday, September 21, 2011

Change font color of link in one div only?

When I change the link color in one div, it changes it for all my divs.

How do I add link color to this div only:

#Footer {

position:absolute;

width:900px;

height:200px;

z-index:3;

left: 0px;

top: 857px;

background-color: #2142C3;

color: #fff600;

font-family: ';Times New Roman';, Times, serif;

}Change font color of link in one div only?
The link styles are a bit confusing to me for some reason (I get confused whether the color attribute and text-decoration attribute are supposed to go in the a selector or the a:link selector), but if you want to only affect an element inside a specific element, do this:



#Footer a {

color: #FF0;

}



#Footer a:visited {

color: #FF1010;

}



#Footer a:hover {

text-decoration: underline;

}



That will only affect the a tags in the element with the Footer id applied to it.



Good luck!

Blake

No comments:

Post a Comment