I have a class for th footer BUT I want to define a certin style for all the links I'll have under this class. Here's what I got so far:
#footer {color: #845746; font: 10px tahoma; text-align: center; padding: 6px 0 20px 37px;}
a.footer:link {text-decoration: none; color: #fff;}
a.footer:visited {text-decoration: none; color: #fff;}
a.footer:hover {text-decoration: underline; color: #fff;}
For some reason, it doesn't work. Did I miss something?
Thanks!Well, to reference a class you use a . so this rule:#footer { ... }Should be this:.footer { ... }And if your links are INSIDE the element with the class of footer then they should be referenced like this:.footer a { ... }
.footer a:link { ... }
.footer a:visited { ... }
.footer a:focus { ... }
.footer a:hover { ... }
.footer a:active { ... }A few questions...
What's the focus is for?
And I want to use # insted of class it's ok?
Thanks man!# is for referencing ID's (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS1#class-as-selector">http://www.w3.org/TR/CSS1#class-as-selector</a><!-- m -->) and . is for referencing classes (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS1#class-as-selector">http://www.w3.org/TR/CSS1#class-as-selector</a><!-- m -->). If you wanted to use id="footer" then you would reference it with #footer.
Links have focus when they are selected but not being activeted, for example, if you were to tab to a link, if would have focus. More on focus, hover and active. (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes">http://www.w3.org/TR/CSS21/selector.htm ... do-classes</a><!-- m -->)
It's all in the W3C specs.Thank you David!Happy to help.
#footer {color: #845746; font: 10px tahoma; text-align: center; padding: 6px 0 20px 37px;}
a.footer:link {text-decoration: none; color: #fff;}
a.footer:visited {text-decoration: none; color: #fff;}
a.footer:hover {text-decoration: underline; color: #fff;}
For some reason, it doesn't work. Did I miss something?
Thanks!Well, to reference a class you use a . so this rule:#footer { ... }Should be this:.footer { ... }And if your links are INSIDE the element with the class of footer then they should be referenced like this:.footer a { ... }
.footer a:link { ... }
.footer a:visited { ... }
.footer a:focus { ... }
.footer a:hover { ... }
.footer a:active { ... }A few questions...
What's the focus is for?
And I want to use # insted of class it's ok?
Thanks man!# is for referencing ID's (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS1#class-as-selector">http://www.w3.org/TR/CSS1#class-as-selector</a><!-- m -->) and . is for referencing classes (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS1#class-as-selector">http://www.w3.org/TR/CSS1#class-as-selector</a><!-- m -->). If you wanted to use id="footer" then you would reference it with #footer.
Links have focus when they are selected but not being activeted, for example, if you were to tab to a link, if would have focus. More on focus, hover and active. (<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes">http://www.w3.org/TR/CSS21/selector.htm ... do-classes</a><!-- m -->)
It's all in the W3C specs.Thank you David!Happy to help.