tr背景色? [英] tr background-color?

查看:139
本文介绍了tr背景色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有人可以确认是否可以在CSS中为表格行设置背景颜色

属性(< tr>)?


我的代码是:


table {display:table; table-layout:fixed; }

tr {display:table-row; }

td,th {display:table-cell; }


和......


table {text-align:left;边框:1px纯银; font-size:1em;

宽度:100%;保证金:2px; }

td {padding:0.3em; }

tr {border:1px solid silver; }

tr.darker {background-color:#cccccc; }

tr.lighter {background-color:#f7f7f7; }

th {padding:0.3em; }


非常感谢,

Matt :)

解决方案

Matt Bostock <毫安** @ mattbostock.com>写道:

有人可以确认是否可以在CSS中为表格行(< tr>)设置背景颜色
属性?


间接地:


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

tr {display:表行; } {/ td,th {display:table-cell; }




指定默认值通常是没有意义的。


-

Spartanicus


Spartanicus schrieb:

Matt Bostock< ma ** @ mattbostock.com>写道:

有人可以确认是否可以在CSS中为表格行设置背景颜色
属性(< tr>)?


间接地:




直接也是。当表格单元格具有

非透明背景颜色时,你当然看不到它。

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


不是这种情况:)我在

样式表以减少浏览器的不一致。


Matt


Spartanicus写道:

Matt Bostock< ;毫安** @ mattbostock.com>写道:

有人可以确认是否可以在CSS中为表格行设置背景颜色
属性(< tr>) ?



间接地:

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

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



指定默认值通常没有意义。



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 :)

解决方案

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


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>


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.



这篇关于tr背景色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆