Page 1 of 1

Help in CSS?

Posted: Thu Feb 18, 2010 9:33 am
by adilmarwat2004
I have table in dynamic table php. In which different data fields contains.

I want to set the 1st row color "red" and 2nd row "white" and again 3rd row "red" and so on.

How can I set it that it could be readable every row easily.

--
Adil Rauf

Re: Help in CSS?

Posted: Thu Feb 18, 2010 10:20 am
by pickle
Generally how this is done is you give every second row a class of "odd" - usually by using the modulus operator in some way. Then in CSS, you give all table rows one colour, and rows of class "odd" another colour.

FYI, the term for this is "zebra striping", and I'm sure Google has some helpful resources if necessary.

Re: Help in CSS?

Posted: Thu Feb 18, 2010 2:09 pm
by daedalus__
css3 has new selectors which make this super easy. something to keep in mind for the future