Classes td and td.somthing...?

S

Sonnich

Hi!

Say, I have:

font { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px}
td { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px }
..aa2 { font-family: Tahoma; color: #990000; text-decoration: none;
cursor: hand }

Idea: default colour is set, though for some <tr I'd like to set the
class like <tr class='aa2'> etc...
It works with <td class='aa2'>, but not for <tr

can anyone give me a hint here?

BR
Sonnich
 
D

dorayme

Sonnich said:
font { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px}
td { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px }
.aa2 { font-family: Tahoma; color: #990000; text-decoration: none;
cursor: hand }

You could play with:

<style type="text/css">
font {color: #00c;}
tr.aa2 td {color: #0c0;}
td {color: #c00;}
</style>
</head>

<body>
<table><tr class="aa2"><td>text</td><td>text</td></tr></table>

....
 
S

Sonnich

You could play with:

<style type="text/css">
font {color: #00c;}
tr.aa2 td {color: #0c0;}
td {color: #c00;}
</style>
</head>

<body>
<table><tr class="aa2"><td>text</td><td>text</td></tr></table>

thanks

will study that

can I add :hover to that?
 
D

dorayme

Sonnich said:
thanks

will study that

can I add :hover to that?

Perhaps you better provide a url at this point. The
text-decoration as you have it is not necessary, but you may be
wanting things that are not evident yet. URL is the way to go
with as real a code as will reveal your true intentions.

font-size: 12px is rarely a good idea. But you can look up the
matter. Perhaps:

http://www.wilsonminer.com/posts/2007/mar/16/problem-pixels/

will be of interest?
 
J

Jukka K. Korpela

Scripsit Sonnich:
Say, I have:

font { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px}
td { font-family: Verdana, Arial, Helvetica, sans-serif; color:
#333333; text-decoration: none; font-size: 12px }
.aa2 { font-family: Tahoma; color: #990000; text-decoration: none;
cursor: hand }

Then you should forget all you thought you knew about CSS and start learning
it properly. There are many good books on it around. (I could send you mine
but it's in Finnish. :))

Not a single setting in the fragment is good, useful CSS. It would take too
many pages to explain why, and a URL would be needed to explain in detail
why the settings are all wrong. But that's not important right now. Just two
examples: The font element should not be used, so why are you using its name
as a selector? Setting font size in pixels is destructive since it prevents
most IE users from changing the font size, and many millions of them cannot
read 12px text. (You don't even know the size of a pixel on other people's
screens.)
Idea: default colour is set, though for some <tr I'd like to set the
class like <tr class='aa2'> etc...
It works with <td class='aa2'>, but not for <tr

That's not a problem. The simplest approach is to use .aa2 as a selector
(just dot and class name). You would set the color of the tr element, and
this color would be inherited by td elements inside it, unless some style
sheet sets their color. Of course, you shouldn't use a class name like
'aa2', which says nothing when you try to figure out next year how your page
works when a problem has detected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top