Alternating Colors For Table Rows

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

bokehman wrote:You only need one class. The non-inverted row will then default to the style of a <tr> with no class. Demo... except thats a <ul> styled like that
This was just for the example, just like when someone ask something about $_POST for eaxmple - I don't teach him at the same time about the security issuses, that would be impossible because then you need to explain X too, Y, Z and so on... It never ends.
bokehman wrote:Also I don't like the idea of the style being embeded in the tag; I want to be able to control everything to do with style from the stylesheet, not by editing a php file.
Again, that's was just an example, you'll never see styles embeded in my tags, never. I always use an external CSS file.
(I'm talking here ^^^ about a real code of mine, not examples on this forum, although I do my best not to do so even in the examples I give here - I think I've never given an example with embeded style in the tags on the forum too :D)
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

onion2k wrote:If you want to be able to control everything from the CSS file, wouldn't it be better to assign two classes (dark and light) rather than using one class and an unstyled table row? :P
That would depend on the needs of the specific page but if the table were the only table within an IDed ascendant element it would certainly not be necessary. And it is not an unstyled row, it is row that has been styled without using a class.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

onion2k wrote:If you want to be able to control everything from the CSS file, wouldn't it be better to assign two classes (dark and light) rather than using one class and an unstyled table row? :P
Guys, you are missing the point here - what you are talking about is beyond the scope of this thread.
It really depends on the script. One will want it like this: odd rows will get some color according to their class, even rows will get the default color of table rows... Hence, only one class is needed.
The other guy will want it like this: odd rows get their color according to class_1, even rows get their color according to class_2... Hence, two classes.
Post Reply