表与交替颜色的行 [英] Table with rows of alternating colours
问题描述
问候。
CSS是否可以拥有HTML< tablesuch,偶数编号
< trrows有一种背景颜色,并且奇数< trrows有
另一种背景颜色?这使得宽表更容易阅读。
我希望通过将CSS类仅应用于< table>
元素来实现此目的。将两个不同的类应用于备用< trelements是不可取的,因为这样就不可能在不破坏颜色交替的情况下添加,删除或排序表
行。
如果有人可以给我一个例子,我会非常感激。
问候,
特里斯坦
-
_
_V.-o Tristan Miller [en,(fr,de,ia)]>< ;空间有限
/ |` - '' - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =<在ha句中,所以很难
(7_ \\ http://www.nothingisreal.com/ ><完成你的任务
Greetings.
Is it possible with CSS to have an HTML <tablesuch that even-numbered
<trrows have one background colour, and odd-numbered <trrows have
another background colour? This makes wide tables easier to read.
I would like this to work by applying a CSS class to only the <table>
element. Applying two different classes to alternate <trelements is
undesirable, as then it would be impossible to add, delete, or sort table
rows without ruining the colour alternation.
If someone could point me to an example, I would be much obliged.
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-'' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= < In a haiku, so it''s hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
推荐答案
Tristan Miller< ps * *******@nothingisreal.comwrote:
Tristan Miller <ps********@nothingisreal.comwrote:
> CSS是否可以拥有HTML< tablesuch,偶数编号
< trrows有一种背景颜色,而奇数< trrows有另一种背景颜色?这使得宽表更容易阅读。
我想通过应用CSS来实现这一点类只有< table>
元素。应用两个不同的类来交替< trelements是不可取的,因为那样就不可能添加,删除或排序表格
破坏颜色交替。
>Is it possible with CSS to have an HTML <tablesuch that even-numbered
<trrows have one background colour, and odd-numbered <trrows have
another background colour? This makes wide tables easier to read.
I would like this to work by applying a CSS class to only the <table>
element. Applying two different classes to alternate <trelements is
undesirable, as then it would be impossible to add, delete, or sort table
rows without ruining the colour alternation.
CSS 2.x不可能,它需要上课。
它是CSS3的一部分但是afaik任何人都没有实现所需的选择器
。
-
Spartanicus
Not possible with CSS 2.x, it requires classes.
It is part of CSS3, but afaik the required selectors haven''t been
implemented by anyone yet.
--
Spartanicus
Spartanicus写道:
Spartanicus wrote:
Tristan Miller< ps ******** @ nothingisreal.comwrote:
Tristan Miller <ps********@nothingisreal.comwrote:
> CSS是否可以使用HTML< tablesuch
偶数< trrows具有一种背景颜色,并且奇数编号
< trrows有另一种背景颜色?这使得宽表更容易阅读。
我希望通过将CSS类仅应用于< table>
元素来实现这一点。将两个不同的类应用于备用< trelements
是不可取的,因为在不破坏颜色交替的情况下添加,删除或排序表行是不可能的。
>Is it possible with CSS to have an HTML <tablesuch that
even-numbered <trrows have one background colour, and odd-numbered
<trrows have another background colour? This makes wide tables
easier to read.
I would like this to work by applying a CSS class to only the <table>
element. Applying two different classes to alternate <trelements
is undesirable, as then it would be impossible to add, delete, or
sort table rows without ruining the colour alternation.
CSS 2.x不可用,它需要课程。
它是CSS3的一部分,但是不需要选择者还没有实现任何人实施的
。
Not possible with CSS 2.x, it requires classes.
It is part of CSS3, but afaik the required selectors haven''t been
implemented by anyone yet.
是的:
http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
根据webdevout.net不支持。
我通常让PHP构建我的列表/表格,并在每个其他
元素中回显甚至类。
Grtz,
-
Rik Wasmus
Yup:
http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
According to webdevout.net not supported.
I usually let PHP build my lists/tables, and echo a class ''even'' every other
element.
Grtz,
--
Rik Wasmus
问候。
>
文章< 23 *************************** @ news1.tudelft.nl> ,Rik写道:
Greetings.
In article <23***************************@news1.tudelft.nl> , Rik wrote:
我通常让PHP构建我的列表/表,并且每个回显一个类''even''
其他元素。
I usually let PHP build my lists/tables, and echo a class ''even'' every
other element.
我是PHP的新手;我已经订购了一些O''Reilly书籍,但它们还没有到货。您(或其他任何人)有机会发布一些样本
代码来构建这样的表格吗?
问候,
特里斯坦
-
_
_V.-o Tristan Miller [en,(fr,de,ia)]> <空间有限
/ |` - '' - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =<在ha句中,所以很难
(7_ \\ http://www.nothingisreal.com/ ><完成你的工作
I''m completely new to PHP; I''ve ordered some O''Reilly books but they are
yet to arrive. Any chance you (or anyone else) could post some sample
code for constructing such a table?
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-'' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= < In a haiku, so it''s hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
这篇关于表与交替颜色的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!