3 replies [Last post]
nudave04
Offline
newbie
Last seen: 16 years 50 weeks ago
Joined: 2004-02-03
Posts: 10
Points: 0

I am trying to override a defined link style with a class, but it isn't working. Here is all of my relevant code:

From my style.css:

a:link {
font-weight: bold;
color: #ffffff;
text-decoration: none;
}

.hidden {
font-size: x-small;
font-weight: lighter;
color: #0033CC;
}

From my web page:

<p align="center"><a href="mylink.html" target="mainFrame" class="hidden">admin</a></p>

The font does come out x-small (the only aspect of the hidden class that is not in conflict with the a:link style, but it stays white and bold rather than blue and light. Is my code incorrect or am I misunderstanding how css works?

The page is http://www.wanderingjew.net (the "admin" link at the bottom left). It was designed in a combination of dreamweaver and textedit, and this problem is the same in all browsers (PC and mac) that I have tested it on.

Thanks!

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 51 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Overriding link sytle with class

The :link pseudoclass takes priority (and therefore the style from the A tag). Stick .hidden:link instead and (IE6 and Opera) show it as hidden.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

Maujor
Maujor's picture
Offline
Regular
Rio de Janeiro, Brazil
Last seen: 4 years 12 weeks ago
Rio de Janeiro, Brazil
Timezone: GMT-2
Joined: 2003-11-21
Posts: 46
Points: 2

Overriding link sytle with class

Hi Nudav04,
You must "increase the weight" for the .hidden rule in order to overwrite the a:link ruler.
Change the CSS selector to a.hidden instead .hidden
Hope you understood my english! Sad

Maurício "Maujor®" Samy Silva
Site: http://maujor.com
Books: http://livrosdomaujor.com.br

nudave04
Offline
newbie
Last seen: 16 years 50 weeks ago
Joined: 2004-02-03
Posts: 10
Points: 0

Overriding link sytle with class

Thanks! changing the style to a.hidden worked great, especially considering i only wanted to apply it to links anyway.

-Dave