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
Help in CSS?
Moderator: General Moderators
Re: Help in CSS?
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.
FYI, the term for this is "zebra striping", and I'm sure Google has some helpful resources if necessary.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: Help in CSS?
css3 has new selectors which make this super easy. something to keep in mind for the future