472,097 Members | 1,072 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,097 software developers and data experts.

tr background-color?

Hi,

Can someone confirm whether it's possible to set the background-color
property in CSS for a table row (<tr>)?

My code is:

table { display: table; table-layout: fixed; }
tr { display: table-row; }
td, th { display: table-cell; }

and...

table { text-align: left; border: 1px solid silver; font-size: 1em;
width: 100%; margin: 2px; }
td { padding: 0.3em; }
tr { border: 1px solid silver; }
tr.darker { background-color: #cccccc; }
tr.lighter { background-color: #f7f7f7; }
th { padding: 0.3em; }

Many thanks,
Matt :)
Jul 21 '05 #1
9 56025
Matt Bostock <ma**@mattbostock.com> wrote:
Can someone confirm whether it's possible to set the background-color
property in CSS for a table row (<tr>)?
Indirectly:

tr.classname td{background-color:#aaa}
tr { display: table-row; }
td, th { display: table-cell; }


Specifying default values is normally pointless.

--
Spartanicus
Jul 21 '05 #2
Spartanicus schrieb:
Matt Bostock <ma**@mattbostock.com> wrote:
Can someone confirm whether it's possible to set the background-color
property in CSS for a table row (<tr>)?


Indirectly:


Directly too. You cannot see it of course, when the table cells have a
non-transparent background color.
<http://www.w3.org/TR/CSS21/tables.html#table-layers>
Jul 21 '05 #3
Not in this case :) I'm using 'body *' selectors at the start of my
stylesheets to reduce browser inconsistencies.

Matt

Spartanicus wrote:
Matt Bostock <ma**@mattbostock.com> wrote:

Can someone confirm whether it's possible to set the background-color
property in CSS for a table row (<tr>)?

Indirectly:

tr.classname td{background-color:#aaa}

tr { display: table-row; }
td, th { display: table-cell; }

Specifying default values is normally pointless.

Jul 21 '05 #4
Christoph Päper wrote:
Directly too. You cannot see it of course, when the table cells have a
non-transparent background color.
<http://www.w3.org/TR/CSS21/tables.html#table-layers>


Thanks! I'll try that :)
Jul 21 '05 #5
Hi Christopher,

That didn't work for me (I set the td's background-color to
'transparent'). I'm using Firefox 1.04. Am I missing something?

Matt

Christoph Päper wrote:
Directly too. You cannot see it of course, when the table cells have a
non-transparent background color.
<http://www.w3.org/TR/CSS21/tables.html#table-layers>

Jul 21 '05 #6
On Thu, 2 Jun 2005, Matt Bostock wrote:
That didn't work for me (I set the td's background-color to
'transparent'). I'm using Firefox 1.04.
I don't quite understand where your problem is. As an example, see
http://www.unics.uni-hannover.de/nht...-alphabet.html
http://www.unics.uni-hannover.de/nhtcapri/screen.css
Am I missing something?


Please adjust your quoting style. Thank you!

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 21 '05 #7
Andreas Prilop wrote:
I don't quite understand where your problem is. As an example, see
http://www.unics.uni-hannover.de/nht...-alphabet.html
http://www.unics.uni-hannover.de/nhtcapri/screen.css


Thanks Andreas I'll give it another shot.

Matt
Jul 21 '05 #8
Andreas Prilop wrote:
I don't quite understand where your problem is. As an example, see
http://www.unics.uni-hannover.de/nht...-alphabet.html
http://www.unics.uni-hannover.de/nhtcapri/screen.css


I'll rephrase my question. Can a <tr> element with a display property of
'table-row' have a background-color set for it?

Many thanks,
Matt :)
Jul 21 '05 #9
Matt Bostock schrieb:
Hi Christopher,


Hello Matze!
<http://www.w3.org/TR/CSS21/tables.html#table-layers>


That didn't work for me (I set the td's background-color to
'transparent'). I'm using Firefox 1.04. Am I missing something?


I expected you'd say you're using IE, which has problems in this area.
Firefox should be fine.

In <http://webdesign.crissov.de/temp/table-layers.html> all cells, where
the first number is odd and the second is even, should have a blue
background. I suppose you miss something in your code, which you didn't
show us (completely).
Jul 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Gequina | last post: by
3 posts views Thread by ribinha | last post: by
3 posts views Thread by Viken Karaguesian | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.