Topic on Project:Support desk

Apply style to a column in a table

8
維基小霸王 (talkcontribs)

How to apply style to a column in a table? I have added the desired style in the first few rows in the table. Do I must repeat the styles in every row?

SolidBlock (talkcontribs)

I have heard of an html tag named col, but it does not seem to work in mediawiki.

217.91.3.31 (talkcontribs)

If you want the same style on every row of the table, you just need to set all styles in the head of the table.


Example:

{| class="wikitable" style="text-align: center; color: green;"

|Orange |Apple |12,333.00 |- |Bread|Cake|500.00 |- |Butter|Ice Creme|1.00 |}


In this table every row will have the color green

SolidBlock (talkcontribs)

a specific column, not an entire table or a row

Jonathan3 (talkcontribs)
維基小霸王 (talkcontribs)

So there is no way. I can only repeat the style in every row.

Jonathan3 (talkcontribs)

Maybe you could create a template to call for each row. The template would contain the CSS style. This could look neater and be easier to change.

維基小霸王 (talkcontribs)

Yes. This is exactly what I did.