[Project_owners] Table row formatting with CSS

Michael Johnston special.michael at gmail.com
Thu May 4 12:56:48 EDT 2006


http://archivist.incutio.com/viewlist/css-discuss/27054

On 5/4/06, Gerald Vogt <vogt at spamcop.net> wrote:
> In an attempt to cleanup my generated HTML from embedded formatting I
> was wondering if it is possible to format HTML elements in an
> alternating way, for instance format rows in a table with two or more
> colors alternately.
>
> At the moment the generated HTML looks something like:
>
> <table>
> <tr class="c1">contents here</tr>
> <tr class="c2">contents here</tr>
> <tr class="c1">contents here</tr>
> more rows go here
> </table>
>
> But obviously, if I wanted to switch this to a three color alternation
> (c1, c2, c3) I would have to modify my source code to generate different
> code. I could assign each row an individual class but that way I would
> have to know the maximum number of rows which I do not know. So I
> thought there should be a way to use the same class for all rows (e.g.
> "c") and the definition for that class would do the alternation. But
> after browsing through the CSS2 spec I have the impression that this is
> not possible.
>
> Is it possible to do this kind of alternations just with CSS, i.e.
> without the need to put it into the generated HTML code?
>
> Thx, Gerald
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list