css odd rows not working

B

bartomolina

when i use the css tr.odd attribute, nothing happens, odd rows are
still white (Firefox 2 and IE 6)!!!!

<html>
<head>
<style type="text/css">
tr.odd {background: #000}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
</tbody>
</table>
</body>
</html>

If I use tr {background: #000} instead, it works fine: all rows are
black.

Someone knows which is the problem??
 
U

Usenet

when i use the css tr.odd attribute, nothing happens, odd rows are
still white (Firefox 2 and IE 6)!!!!

Because what you've written defines a row class "odd", but you
haven't *used* it anywhere.

With what you've done you need to use

<tr class="odd">{Row Cells}</tr>


It works when you specify it as tr {background: #000} because this
sets up a styles for all table rows.

Might do to have another look at the specs about classes...

Happy Easter
Mark
 
B

Bergamot

when i use the css tr.odd attribute, nothing happens
tr.odd {background: #000}

tr.odd td {background: #000}

BTW, tr.odd is not an attribute, it's a selector. You should also set a
foreground color to go with that background, otherwise you could end up
with unreadable black on black.
 
E

Edwin van der Vaart

Usenet said:
Because what you've written defines a row class "odd", but you
haven't *used* it anywhere.

With what you've done you need to use

<tr class="odd">{Row Cells}</tr>


It works when you specify it as tr {background: #000} because this
sets up a styles for all table rows.

Might do to have another look at the specs about classes...
Something like [http://www.w3.org/TR/REC-CSS2/selector.html]
or [http://www.w3.org/TR/REC-CSS1#class-as-selector]
--
Edwin van der Vaart
http://www.semi-conductor.nl/ Links to Semiconductors sites
http://www.evandervaart.nl/ Edwin's persoonlijke web site
Explicitly no permission given to Forum4Designers, onlinemarketingtoday,
24help.info, issociate.de and software-help1.org to duplicate this post.
 

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

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top