Don't like the ads? Then create an account! Users with accounts have more options than anonymous users. |
Help:Table
This page serves as a tutorial on how to create and format a table.
Code[edit]
To create a table, you will first need to understand what the symbols mean:
- {| - Signifies the start of a table.
- |} - Signifies the end of a table.
- |+ - Signifies the caption of a table; what text will appear above it, labeling it.
- |- - Signifies the start of a table row.
- | - Signifies the start of a regular table cell.
- ! - Signifies the start of a header table cell. The text within a header cell is boldfaced.
- || - Signifies the switch to a new cell within a row.
- !! - Signifies the switch to a new header cell within a row.
Usage[edit]
Here is how you would use these symbols appropriately:
{| |+ This is the caption for my table. |- ! These !! are !! my !! table !! headers |- | These || are || my || regular || cells |}
Styling[edit]
To modify a specific cell, a row, or the entire table, you would use the style attribute:
Placing the style attribute after the {| symbol alters the entire table:
{| style="font-family: (a font family);border: (a thickness)"
Placing the style attribute after the |+ symbol alters the table's caption. Use the pipe symbol to divide it from the text:
|+ style="font-family: (a font family);color: (# a color)" | This is the caption for my table.
Placing the style attribute after the |- symbol alters the entire row that follows it:
|- style="font-family: (a font family);color: (# a color)"
Placing the style attribute after the | symbol alters a single cell. Use the pipe symbol to divide it from the text:
| style="font-family: (a font family);color: (# a color)" | These || are || my || regular || cells
Please note that styling a single cell has the most precedence. This means that if you style the table's background red, and style a single cell black, the single cell will appear black, rather than red.
Wikitable[edit]
It is recommended that you add class="wikitable"
at the start of the table to make it into a wikitable, as they already have predefined attributes and require less coding to be added on to an article. Style attributes can still be applied to a wikitable.
Here is an example of a wikitable:
Test | Test 2 |
---|---|
Input text here | Nintendo |
Here is the source of the provided example:
{|class="wikitable" !Test !Test 2 |- |Input text here |Nintendo |}