Page MenuHomePhabricator

wikitable header style should be set by row
Closed, DeclinedPublic

Description

Currently this doesn't work (tested en/it.wiki IE10/FF45):

{| class="wikitable"
|- style="background-color:yellow"
! column1 !! column2 !! column3
|}

You have to set styles cell by cell, which is annoying:

{| class="wikitable"
|-
! style="background-color:yellow" | column1 !! style="background-color:yellow" | column2 ...
|}

The example is for color, but it's the same for other styles like text-align.

I propose to set the CSS style of headers by row, not by cell, so it can be overridden by row.
Something like this normally works:

.wikitable tr th { background-color:... }

Event Timeline

Bultro created this task.Mar 18 2016, 3:53 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 18 2016, 3:53 PM

Hi Bultro,

If you look at the raw HTML, it is outputting what you expect. The reason the background isn't changing is that the th elements are styled individually. So their background is superimposed over the yellow, hiding it.

I'm not sure how it could be done another way.

If you are an administrator on your wiki, have a look at MediaWiki:Common.css. You can add styles there and reference them on your tables.

table.yellow-header th { background-color: yellow; }
{| class="wikitable yellow-header"
|-
! column1 !! column2 !! column3
|}

Alternately, maybe someone has already created the style you need and you can reference that existing style.

That's exactly what i said: the th are styled individually by the default wikitable class. They shouldn't, and the row should be styled instead.

It's not a matter of "my" tables; why overwrite the class on every wiki, when the default one could be designed better?

How would you choose the rows/columns?

There are many cases where the headers are a column, a row and a column, or there are multiple header rows.

Example:
https://en.wikipedia.org/wiki/Comparison_of_web_browsers#Security_and_vulnerabilities

Danny_B closed this task as Declined.Jul 9 2016, 7:42 PM
Danny_B added a subscriber: Danny_B.

Better (more flexible) solution:

{| class="wikitable"
|- class="wikitable-yellow-header"
! column1 || column2 || column3
|-
| val1 || val2 || val3
|- class="wikitable-blue-header"
! column1 || column2 || column3
|-
| val1 || val2 || val3
|}

Declining because