Help:Table

From Pikmin Fanon
Pikilogo.png
This is one of Pikmin Fanon's help pages and is meant to aid users by improving their ability to positively contribute to the wiki. Expanding pages such as this with additional information is always welcome.
Pikilogo.png
To do:
  • Describe how to make the contents of a table organizable, how to merge and resize table cells, how tables are managed via visual editor, and more.
  • Also, describe the fancy tables some pages such as this one and especially this one have.)

A table is commonly used to display a variety of data.

Markup

Tables always start using {| and end with |}. A column header of a table is made using ! insert text here. A standard cell of a table is made with |. For cells, each new one will move to the right cell in the current row. A row break is made with |-. Each of these should have a line break between them in the editor. For example:

{|
!column one
!column two
|-
|cell one, row one
|cell two, row one
|-
|cell one, row two
|cell two, row two
|}

produces:

column one column two
cell one, row one cell two, row one
cell one, row two cell two, row two

Modifiers

Tables can be modified using classes. Each of these should be inside a table after the initial {| by typing class="class-1 class-2 etc". These commonly used table modifiers are listed in the following:

  • wikitable (Makes the table have the standard background and borders. Used on most tables.)
  • mw-collapsible (Makes the table collapsible. Useful on large tables. Put   at the end of the last column to avoid overlap with the [collapse] button.)
  • mw-collapsed (Makes the table collapse. Should only be used alongside mw-collapsible. Can be used with one cell and without wikitable to make content hidden.
  • sortable (Makes the table sortable by column alphabetically. Use ! class="unsortable" | column name to make a specific column unsortable.)

By adding all of these modifiers to the table from before, this is produced:

column one column two 
cell one, row one cell two, row one
cell one, row two cell two, row two

Rowspan and colspan

A more advanced aspect of tables is rowspan and colspan. These are added to individual cells. They are made by typing rowspan="x" | (or colspan) after the | or ! that defines the cell, but before the content of it. x is the number of cells that the single cell should stretch across. Rowspan causes it to stretch vertically, and colspan causes it to stretch horizontally.

Header with a colspan of 3
Normal cell with a rowspan of 2 filler filler
filler This cell is technically on a different row than the cell with the rowspan in the code, but because the cell stretches across two rows, it displays as the same row as this one and therefore is stretched vertically by this one stretching.