Last modified: 2010-11-12 13:00:25 UTC
Some Mediawiki projects have templates to defined which row in a table should use an alternative color to improve readability. This is very unpractical this gets messy as soon as an entry is added in proper order, all the alternate color row need to be shifted. Having a build-in alternate row class would allow for css definition whether colors should alternate or not. For exemple the class wikitable could have its <tr> elements in the tr.alt class with a different color, all this defined in css. Every odd tr would be in tr.alt and every even would not have any specific class, or odd tr would be tr.odd and even ones tr.even. See French Wikipedia Table guidelines using {{ligne grise}} : http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Projet/Charte_graphique/Apparence_des_tableaux
What does this mean?
(In reply to comment #1) > What does this mean? I believe the request is to have the table rendering engine add classes to "odd" or "even" rows in the generated <tr> elements such that CSS could be used to give background-color properties to alternating rows, making them stand out more. This might be better achieved using JavaScript, like the sortable tables feature, which acts on tables with a specified class.
Oh, sorry for never getting back. Rob, you're right this could probably be done through Javascript with CSS.
You don't even need JavaScript, just a browser with support for the :nth-child() selector. This CSS definition works on Konqueror: table.alternate tr:nth-child(even) { background: #ff0000; } table.alternate tr:nth-child(odd) { background: #00ff00; } This can be added to MediaWiki:Common.css, no need for changes to the Mediawiki code. (OK, I just saw that at least Firefox doesn't support this right now, so it is not yet a full solution)
Closing this bug, the requested feature can be implemented with CSS selector nth-child.