Jump to content

Topic on Extension talk:Capiunto

Row-styling function

3
Mr. Stradivarius (talkcontribs)

We had a discussion on the enwiki Template:Infobox talk page a while back about having different styles for odd- and even-numbered headers in infoboxes. At the moment this happens in en:Template:Infobox baseball biography, for example in the en:Ichiro Suzuki article, which alternates the colour of the header cells between each of Ichiro's two team colours. At the moment it does this by using a horrible hack; each second header in the infobox is in fact a child infobox with the headerstyle set to the team's secondary colour. It would be nice to be able to specify conditional styles for rows or headers so that we can do away with hacks like this.

Different infoboxes will have different requirements for conditional styling, though. One infobox might require every even-numbered header to be a certain colour, and another might require every second data row after a header to be a certain colour. Because of this, I think the functionality may be best implemented as a function that can be passed to the infobox object. It would take a few different parameters as input: the row number, the header number, isHeader, and the number of rows since the last header. And as output, it could produce a table that would then be passed to mw.html:css. Is this idea workable?

Proactive programming (talkcontribs)

Old comment, but with modern CSS3 this is very easy to do with standard CSS. No hacking needed.

Mr. Stradivarius (talkcontribs)

I guess this should be easier now that we have Extension:TemplateStyles. I haven't checked to see if this is possible with the subset of styles that are allowed in the extension though.

Reply to "Row-styling function"