The reason that adding the CSS through JS is more robust is that it
addresses the issue of reordering, adding and removing rows within the
table. Granted, if the table HTML is dynamically generated via a back-
end language such as PHP, having the classes hard-coded in the PHP
makes more sense, and reduces the client-side processing. However, if
the site is made up of flat HTML files that are hand-coded, then
making the necessary adjustments every time a row is added or removed
adds an enormous overhead to such simple operations, and makes a
strong case for having JS perform the zebra striping instead.

I thoroughly agree that, when avoidable, JS should not be used for
this purpose. Ideally, browsers would all support the most up-to-date
standards for all languages, and we could just use the CSS X spec
immediately upon its release. However, particularly given the huge
number of users still running IE6, the theoretical functionality
provided by CSS does not nearly match up with the realistic levels,
making pure CSS solutions impossible in many cases.

--
Jake Kronika
Gridline Design
www.gridlined.com

On Dec 11, 6:03 am, Michał Furmaniak <mike.furman...@gmail.com> wrote:
> @jkronika adding styles through j-s?! Horrible! To solve this problem
> class/id the markup properly.
>
> W dniu 2009-12-07 16:48 użytkownik "jkronika" <jkron...@gmail.com> napisał:
>
> One way (and possibly the most robust) would be to make your tables
> zebra-striped using JavaScript. There are many examples of that around
> the web.
>
> As far as a pure CSS solution, I don't believe there is any way to
> zebra-stripe completely in CSS, without either adding markup manually
> or via a script. To make a rule between rows, simply set up this sort
> of style:
>
> table.stripe { border-collapse: collapse; }
> table.stripe th,
> table.stripe td {
>    border-top: 1px solid #000;
>    border-bottom: 1px solid #000;
>
> }
>
> That will give you a black, 1px rule above and below every row,
> without any vertical lines.
>
> On Dec 6, 10:51 am, zalel <nmcca...@gmail.com> wrote: > I am trying to find
> examples of CSS for a t...

-- 
--
You received this because you are subscribed to the "Design the Web with CSS" 
at Google groups.
To post: css-design@googlegroups.com
To unsubscribe: css-design-unsubscr...@googlegroups.com

Reply via email to