0

Im trying to get the links in my footer white #fff however I want to keep the rest of the links on my page the color they already are. How would I do this?

#footer {
background: #3b5998;
color: #fff;
font: 11px/14px Lucida Grande, Lucida, Verdana, sans-serif;
padding: 5px 20px;
}

3 Answers3

1

Perhaps you should add a class to each anchor element within your footer instead of applying the colour to the footer itself:

/*Select only footer tagged elements*/
.footerLink
{
 color:#fff;
}
James Shuttler
  • 1,344
  • 9
  • 15
0

In addition to your original CSS, the following will make your footer links white:

#footer a {
    color: #FFF;
}
  • 1
    While that will work, your key CSS selector is not very efficient, so the parser will first select all anchors within the document before checking to see if they are contained within the footer element. See this [question](http://stackoverflow.com/questions/5797014/css-selectors-parsed-right-to-left-why) or this [post](http://csswizardry.com/2011/09/writing-efficient-css-selectors/) – James Shuttler Jan 20 '12 at 02:23
  • 1
    @James Shuttler All a beginner needs to know about CSS selectors efficiency is: "don't use * (universal selector)". For performance, selectors efficiency has lower priority than knowing about number of requests (CSS sprites), optimization of images, efficiency of JS and events and all of that is certainly confusing for a beginner :( – FelipeAls Jan 20 '12 at 02:49
0
#footer a {
background: #3b5998;
color: #fff;
font: 11px/14px Lucida Grande, Lucida, Verdana, sans-serif;
padding: 5px 20px;
}

This will style only the a elements in the div (presumably) with the id of footer.

j08691
  • 204,283
  • 31
  • 260
  • 272