Click to See Complete Forum and Search --> : Simple class question...


weee
04-22-2005, 06:17 PM
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!

David Harrison
04-22-2005, 06:44 PM
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 { ... }

weee
04-22-2005, 08:33 PM
A few questions...

What's the focus is for?

And I want to use # insted of class it's ok?

Thanks man!

David Harrison
04-22-2005, 09:08 PM
# is for referencing ID's (http://www.w3.org/TR/CSS1#class-as-selector) and . is for referencing classes (http://www.w3.org/TR/CSS1#class-as-selector). 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. (http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes)

It's all in the W3C specs.

weee
04-23-2005, 02:25 PM
Thank you David!

David Harrison
04-23-2005, 02:30 PM
Happy to help. :)