|
Posted by Jukka K. Korpela on 09/12/07 12:25
Scripsit Sonnich Jensen:
> I have code like this:
Do you have a URL?
> td { font-family: Verdana, Arial, Helvetica, sans-serif; color:
> #333333; text-decoration: none; font-size: 12px }
> .aa { font-family: Verdana, Arial, Helvetica, sans-serif; color:
> #990000; text-decoration: none; font-size: 12px; cursor: hand; }
> .aa:hover { font-family: Verdana, Arial, Helvetica, sans-serif; color:
> #000066; text-decoration: none; font-size: 12px; cursor: hand; }
That's not just pointlessly verbose. It also has several common symptoms of
misguided design. Please don't make me started.... I'll just mention ".aa"
(no hint about meaning), Verdana, 12px, and setting color without setting
background.
> problem: the css is a greater part of a project, so I cannot change
> all what I want in there.
Then the person responsible for the project as a whole should tell you how
to work within its general design. What _can_ you change? We have little
possibilities in helping you there, since we don't even know your page's
URL, still less anything about the project as a whole.
> The "aa" is my idea, it is for a clickable table, which works well -
> idea: the entire row should change from red to blue when clicked.
I don't believe you (I mean the part "works well"). Prove me wrong by
posting a URL.
> The problem is "color: #333333;" - once I remove that, it works as
> requested. So, how do I override that colour code up there?
You override a color set for a <td> by setting the color property for the
<td> in a style sheet rule that wins the rule you want to override, by the
CSS cascade mechanism.
> As I mentioned, I cannot remove it, so I have to override it somehow.
Set colors for <td> elements you want to color, not to <tr> elements
containing them. If there were no color setting to <td>, the element would
inherit the color value from its parent (<tr>), but you're telling me there
_is_ a setting and it cannot be removed.
Assuming that the clueless rule
td { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px }
has been carved into stone by a clueless dee-ziner and sanctified by a
pointy-haired boss, so that they are beyond reasonable reconsideration for
now, you could just set
..aa td { color: #990000; cursor: hand; }
..aa:hover td { color: #000066; }
if you really want to do what you are doing. There's no point in repeating
the clueless font settings. (It would involve the risk of preserving those
bad settings for your "clickable rows" even if the overall style sheet of
the project were fixed.)
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|