user7248880
user7248880

Reputation: 11

Styling a column in a mediawiki-table

Is it possible to style a column in a mediawiki table?

I know how to style a cell, but I don't know how to style a column. I would like to give a background color to the whole column.

For instance:

{| class="wikitable"
! a
! b
|-
| c
| d
|}

I want to make the first column (with a and c in it) blue.

Upvotes: 1

Views: 711

Answers (1)

Tgr
Tgr

Reputation: 28160

MediaWiki does not support col or colgroup elements at this time so you'll have to use CSS selectors, or duplicate the styles on every cell (probably a bad idea). With CSS it would look something like this:

table.firstcolumnblue td:first-child {
    background-color: blue;
}

You can put the CSS in MediaWiki:Common.css (admins only) or you can use the brand new TemplateStyles extension to allow normal editors to write CSS rules.

Upvotes: 1

Related Questions