Help:Tables
This page explains the use of wikitables.
If you are still stuck, Wikipedia has a large help page on tables.
Standard table examples
[edit source]{| class="wikitable"
|-
! Header 1
! Header 2
! Header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}
This code produces the following table:
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| row 1, cell 1 | row 1, cell 2 | row 1, cell 3 |
| row 2, cell 1 | row 2, cell 2 | row 2, cell 3 |
{| class="wikitable"
|+ The table's caption
! Column header 1
! Column header 2
! Column header 3
|-
! Row header 1
| Cell 2 || Cell 3
|-
! Row header A
| Cell B
| Cell C
|}
This code produces the following table:
| Column header 1 | Column header 2 | Column header 3 |
|---|---|---|
| Row header 1 | Cell 2 | Cell 3 |
| Row header A | Cell B | Cell C |
{| class="wikitable" style="text-align: center; width: 200px; height: 200px;"
|+ Multiplication table
|-
! ×
! 1
! 2
! 3
|-
! 1
| 1 || 2 || 3
|-
! 2
| 2 || 4 || 6
|-
! 3
| 3 || 6 || 9
|-
! 4
| 4 || 8 || 12
|-
! 5
| 5 || 10 || 15
|}
This code produces the following table:
| × | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
| 4 | 4 | 8 | 12 |
| 5 | 5 | 10 | 15 |
{| class="wikitable"
|-
! Column 1<br />(row 1 cell 1) !! Column 2<br />(row 1 cell 2) !! Column 3<br />(row 1 cell 3)
|-
| rowspan="2" | A<br />(row 2 cell 1)<br /><code>rowspan="2"</code>
| colspan="2" style="text-align: center;" | B<br />(row 2 cell 2)<br /><code>colspan="2"</code>
|-
| C<br />(row 3 cell 1) <!-- column 1 occupied by cell A -->
| D<br />(row 3 cell 2)
|-
| E<br />(row 4 cell 1)
| rowspan="2" colspan="2" style="text-align: center;" |F<br />(row 4 cell 2)<br /><code>rowspan="2" colspan="2"</code>
|-
| G<br />(row 5 cell 1) <!-- column 2+3 occupied by cell F -->
|-
| colspan="3" style="text-align: center;" | H<br />(row 6 cell 1)<br /><code>colspan="3"</code>
|}
This code produces the following table:
| Column 1 (row 1 cell 1) |
Column 2 (row 1 cell 2) |
Column 3 (row 1 cell 3) |
|---|---|---|
| A (row 2 cell 1) rowspan="2"
|
B (row 2 cell 2) colspan="2"
| |
| C (row 3 cell 1) |
D (row 3 cell 2) | |
| E (row 4 cell 1) |
F (row 4 cell 2) rowspan="2" colspan="2"
| |
| G (row 5 cell 1) | ||
| H (row 6 cell 1) colspan="3"
| ||
Collapsible tables
[edit source]Adding collapsible to the table's class will make it collapsible. A further parameter of collapsed will set it collapsed by default and omitting it keeps the table shown by default.
{| class="collapsible collapsed wikitable"
|+ Caption
! Column header 1
! Column header 2
|-
! Row header 1
| Cell 2
|-
! Row header A
| Cell B
|}
This code produces the following table:
| Column header 1 | Column header 2 |
|---|---|
| Row header 1 | Cell 2 |
| Row header A | Cell B |
Sticky tables
[edit source]The header of a table can be made "sticky" so that it remains visible as the page is scrolled.
To make all of a table's headers sticky, add the stikitable class to the table.
{|class="wikitable stikitable ..."
The style attribute can be used to make only specific headers, or even non-header cells sticky.
Add style="position:sticky; top:0;" to cells to make them sticky.
{|class="wikitable"
! Header 1 !style="position:sticky; top:0;" | Sticky Header
...
|}
Examples:
A portion of a large table from Biome; it is not obvious what the values in the cells represent without referencing the headers.
| Biomes | Base temperature | Downfall | Precipitation | Snow accumulation[BE only] | Grass color | Foliage color | Dry foliage color | Sky color |
|---|---|---|---|---|---|---|---|---|
| 2.0 | 0.0 | FALSE | 0.0-0.125 | #90814d |
#9e814d |
#9e814d |
#6eb1ff | |
#bfb755 |
#aea42a |
#a38046 | ||||||
| 2.0[JE only] 1.2[BE only] |
#6eb1ff[JE only] #75aaff[BE only] | |||||||
| 2.0[JE only] 1.0[BE only] |
#6eb1ff[JE only] #76a8ff[BE only] | |||||||
| 1.0 | 0.3 | TRUE | #9abe4b |
#82ac1e |
#927957 |
#76a8ff | ||
| 0.95 | 0.9 | #59c93c |
#30bb0b |
#a36346 |
#77a8ff | |||
| 0.8 | #64c73f |
#3eb80f | ||||||
| 0.9 | 1.0 | #55c93f |
#2bbb0f |
#a36246 | ||||
| 0.8 | 0.9 | #6a7039 #4c763c |
#6a7039 |
#7b5334 |
#78a7ff | |||
| 0.9[JE only] 0.5[BE only] |
#8db127 | |||||||
| 0.8 | 0.4 | #91bd59 |
#77ab2f |
#a37546 |
#78a7ff | |||
| 0.8[JE only] 0.2[BE only] |
0.4[JE only] 0.0[BE only] |
#91bd59[JE only] #8db58a[BE only] |
#77ab2f[JE only] #70a26c[BE only] |
#a37546[JE only] |
#78a7ff[JE only] #7da2ff[BE only] | |||
| 0.7 | 0.8 | #79c05a |
#59ae30 |
#a36d46 |
#79a6ff | |||
#507a32 |
#7b5334 | |||||||
#778272 |
#878d76 |
#a0a69c |
#b9b9b9 | |||||
| 0.6 | 0.6 | #88bb67 |
#6ba941 |
#a37246 |
#7aa5ff | |||
| 0.5[JE only] 0.9[BE only] |
0.5[JE only] 0.0[BE only] |
#8eb971[JE only] #b9b75b[BE only] |
#71a74d[JE only] #a6a432[BE only] |
#a17448[JE only] |
#7ba4ff[JE only] #77a8ff[BE only] | |||
| 0.5 | 0.5 | FALSE | N/A | #8eb971 |
#71a74d |
#a17448 |
#7ba4ff |
The same table as above, but with only one header made sticky.
| Biomes | Base temperature | Downfall | Precipitation | Snow accumulation[BE only] | Grass color | Foliage color | Dry foliage color | Sky color |
|---|---|---|---|---|---|---|---|---|
| 2.0 | 0.0 | FALSE | 0.0-0.125 | #90814d |
#9e814d |
#9e814d |
#6eb1ff | |
#bfb755 |
#aea42a |
#a38046 | ||||||
| 2.0[JE only] 1.2[BE only] |
#6eb1ff[JE only] #75aaff[BE only] | |||||||
| 2.0[JE only] 1.0[BE only] |
#6eb1ff[JE only] #76a8ff[BE only] | |||||||
| 1.0 | 0.3 | TRUE | #9abe4b |
#82ac1e |
#927957 |
#76a8ff | ||
| 0.95 | 0.9 | #59c93c |
#30bb0b |
#a36346 |
#77a8ff | |||
| 0.8 | #64c73f |
#3eb80f | ||||||
| 0.9 | 1.0 | #55c93f |
#2bbb0f |
#a36246 | ||||
| 0.8 | 0.9 | #6a7039 #4c763c |
#6a7039 |
#7b5334 |
#78a7ff | |||
| 0.9[JE only] 0.5[BE only] |
#8db127 | |||||||
| 0.8 | 0.4 | #91bd59 |
#77ab2f |
#a37546 |
#78a7ff | |||
| 0.8[JE only] 0.2[BE only] |
0.4[JE only] 0.0[BE only] |
#91bd59[JE only] #8db58a[BE only] |
#77ab2f[JE only] #70a26c[BE only] |
#a37546[JE only] |
#78a7ff[JE only] #7da2ff[BE only] | |||
| 0.7 | 0.8 | #79c05a |
#59ae30 |
#a36d46 |
#79a6ff | |||
#507a32 |
#7b5334 | |||||||
#778272 |
#878d76 |
#a0a69c |
#b9b9b9 | |||||
| 0.6 | 0.6 | #88bb67 |
#6ba941 |
#a37246 |
#7aa5ff | |||
| 0.5[JE only] 0.9[BE only] |
0.5[JE only] 0.0[BE only] |
#8eb971[JE only] #b9b75b[BE only] |
#71a74d[JE only] #a6a432[BE only] |
#a17448[JE only] |
#7ba4ff[JE only] #77a8ff[BE only] | |||
| 0.5 | 0.5 | FALSE | N/A | #8eb971 |
#71a74d |
#a17448 |
#7ba4ff |
Using tables in templates
[edit source]Tables can sometimes be used as template parameters (inputs); however, the pipe (|) and equals (=) characters used to create tables can cause problems when used as template parameters.
One solution is to replace all instances of | and = with {{!}} and {{=}}, respectively; {{!!}} can be used to replace ||. This prevents the template from misinterpreting pipes and equals signs as part of the template call. Other table characters, such as ! or + do not need special handling.
Another option is to use the {{Pipe escape}} template, which converts all instances of | to !. The equals sign still needs to be replaced with {{=}}.
Note that the each row of the table must be located on a separate line.
Examples
{{FakeImage|
{{{!}}class{{=}}"wikitable"
{{!}}+Title
!Header 1 !! Header 2
{{!}}-
{{!}}Cell1 {{!!}} Cell2
{{!}}}
}}
| Header 1 | Header 2 |
|---|---|
| Cell1 | Cell2 |
{{FakeImage|{{Pipe escape|
{|class{{=}}"wikitable"
|+Title
!Header 1 !! Header 2
|-
|Cell1 {{!!}} Cell2
|}}}
}}
| Header 1 | Header 2 |
|---|---|
| Cell1 | Cell2 |
Using tables on talk pages
[edit source]It is not possible to directly insert a table when replying to a message on a talk page. However, it is still possible to manually insert a table through the source editor.
To insert a table into your reply:
- Make your reply as usual.
- Click Edit source at the top of the page to open the source editor.
- Find your comment and add the table at the desired location.
- Add the appropriate level of indentation. Add a number of colons, (
:) before the first line of the table ({|class=...) equal to the number of colons at the start of your comment.
Example:
Original comment.
:Reply to original comment.
::The part of your reply before the table.
::{|class="wikitable"
!Col A !! Col B
|-
|Row A1 || Row B1
|}
::The part of your reply after the table.
:Another reply to the original comment.
Produces:
Original comment.
- Reply to original comment.
- The part of your reply before the table.
Col A Col B Row A1 Row B1
- The part of your reply after the table.
- Another reply to the original comment.
Navigation
[edit source]| Wiki help | |
|---|---|
| General pages | |
| User rights | |