Template:Wikitable
From GECK
{{Wikitable|param1|param2|param3|class=|style=}}
Use at the beginning of a table to assign the wikitable
and other commonly used table CSS classes. With no parameters, the template outputs class="wikitable"
The param1, param2, and param3 parameters can be any of the following options:
- Collapse options
show
,hidable
, orcollapsible
: Uses thecollapsible
class to show a [hide] link to collapse the table, but leaves the table uncollapsed by defaulthide
,collapse
, orcollapsed
: Uses thecollapsible collapsed
classes to make the table collapsed with a [show] link to reveal the table.auto
orautocollapse
: Uses thecollapsible autocollapse
classes to make the table collapsible, but only collapse it if there are three or more collapsible tables on the pageinner
orinnercollapse
: Uses thecollapsible innercollapse
classes to make the table collapsible, but only collapse if the table is within a larger table with theoutercollapse
class.outer
oroutercollapse
: Uses theoutercollapse
class to collapse any smaller tables within the table it that use theinnercollapse
class. Can be combined with the various collapse and sort options above.
- Sort options
sort
orsortable
: Uses thesortable
class to add sorting buttons to each column of the table. Can be combined with the various collapse options above or withoutercollapse
.
- Other options
- Any other Wikipedia class may be specified using the
|class=
parameter. - Custom styling can be included with the
|style=
parameter.
Up to three parameters can be used, plus the custom |class=
and |style=
parameters, and they can be specified in any order.
Code
The following code:
{| {{Wikitable|class=centercells|style=color:red; width:50%;}} !Header 1 !Header 2 |- |Row 1 Col 1 |Row 2 Col 2 |}
Creates this table:
Header 1 | Header 2 |
---|---|
Row 1 Col 1 | Row 2 Col 2 |
Classes
Class styles are located at MediaWiki:Common.css
Class | Effects |
---|---|
centercells | Centers all cells in the table body |