Please join this new Discord server!

Merge notice

Help:Tables

From Etrian Odyssey Wiki

Tables are a very useful tool for presenting data neatly. There are many different ways of using wikicode, HTML, and CSS, to achieve the desired appearance of the table, although in most situations, only the basics are required. Experiment in the Sandbox to get a feel for designing tables, and don't hesitate to ask for help where necessary.

Basic coding

Basic coding used in designing a table.
Code Purpose
{| Begins a table. Immediately after this, CSS coding (such as class="wikitable") to define the table's appearance should be written.
|+ Used between the table's start and first row to add a caption (which appears above the table, as above).
|- Defines the end of a row, and the beginning of a new one. It may be omitted at the end of the final row.
! Defines a heading. All text in this cell will be bolded, and centred, and the cell will be highlighted.
| Defines a basic cell.
|} Ends the table.
  • Important: Each code must be placed at the beginning of a new line. However, an entire row may be placed on one line, by duplicating the code used to begin the row. This is explained further below.

Simple tables

A series of basic tables, and the required coding.
Description Wikicode Result
The most basic table, a 3x2 table with three headers.
{| class="wikitable"
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
The same table, with an added caption.
{| class="wikitable"
|+ A test table
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| Cell 2
| Cell 3
|}
A test table
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
The same table, with the wikicode contained on one line per row.
{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
An extended table, with randomly added header cells. Any cell can be designated as a "header" by using the ! mark. Note that this effect cannot be achieved with the wikicode contained on one line per row.
{| class="wikitable"
| Header 1
! Header 2
| Header 3
|-
| Cell 1
| Cell 2
! Cell 3
|-
! Cell A
! Cell B
| Cell C
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell A Cell B Cell C

Adding CSS attributes to tables and cells

It's possible to use CSS to customize the appearance of the table, and even individual cells. To make these attributes take effect throughout the entire table, add them to the same line as the "wikitable" class. To change the attributes of a single row, add the code to the line beginning with the table row marker (|-). To change the attributes of a single cell, add the code after the pipe (|) at the beginning, and end the code with another pipe before adding the cell's content.

Note that HTML table attributes such as align, cellpadding, and cellspacing are now deprecated, and should not be used as they may not work as intended. You should use CSS equivalents instead.

A table with the font color changed to red.

{| class="wikitable" style="color: red;"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3

A table with one row's text centred.

{| class="wikitable"
| Normal || Normal || Normal
|- style="text-align: center;"
| Centred || Centred || Centred
|}
Normal Normal Normal
Centred Centred Centred

A table with Cell 2 italicised.

{| class="wikitable"
! Header 1
! Header 2
! Header 3
|-
| Cell 1
| style="font-style: italic;" | Cell 2
| Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3

Another way of coding the above.

{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || style="font-style: italic;" | Cell 2 || Cell 3
|}
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3

Moving a caption to the left of the table, and coloring it blue.

{| class="wikitable" style="caption-side: left;"
|+ style="color: blue;" | Stylised caption
! Header 1 !! Header 2 !! Header 3
|-
| Cell 1 || Cell 2 || Cell 3
|}
Stylised caption
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3

colspan and rowspan: Irregular-sized cells

One cell can be made to span several rows or columns, by using the colspan and rowspan attributes. This has various useful applications. However, the fact that these attributes eliminate certain cells from other parts of the table's coding can significantly increase the overall complexity of the table. Using the Sandbox and the "Show preview" button to learn how these attributes affect a table's appearance is extremely helpful. The attributes accept a numerical value representing the number of rows or columns a single cell should span. This value should be no less than two, and no greater than the total number of rows or columns in the table. The attributes are added to a cell like a HTML or CSS attribute, as follows:

|colspan="2"|Cell content

An example of a table using colspan:

{| class="wikitable"
! Header 1 !! Header 2 !! Header 3
|-
|colspan="2"|Cell 1+Cell 2 || Cell 3
|}
Header 1 Header 2 Header 3
Cell 1+Cell 2 Cell 3

rowspan is a little more difficult to code:

{| class="wikitable"
!rowspan="2"|Header 1+Cell 1 !! Header 2 !! Header 3
|-
| Cell 2 || Cell 3
|}
Header 1+Cell 1 Header 2 Header 3
Cell 2 Cell 3

Sortable tables

Sortable tables are useful in tables that contain information that may benefit from being quickly sortable, either alphabetically or numerically. To make a sortable table, change the "wikitable" class at the top of the table to "wikitable sortable". This class places sorting buttons in the table's top headings. Clicking these sorts the entire table according to that column's data. To remove the sort button from a single column, add the "unsortable" class to that column's header. If a column contains a mixture of alphabetical and numerical data, the data will be grouped into the two separate types before sorting. Note that sorting is generally incompatible with colspan and rowspan.

{| class="wikitable sortable"
! Numbers !! Letters !! Mix
|-
| 1 || B || 2
|-
| 3 || D || A
|-
| 2 || A || 3
|-
| 5 || C || B
|-
| 4 || E || 1
|}
Numbers Letters Mix
1 B 2
3 D A
2 A C
5 C B
4 E 1

Preventing the "Mix" column from being sorted:

{| class="wikitable sortable"
! Numbers !! Letters !! class="unsortable" | Mix
|-
| 1 || B || 2
|-
| 3 || D || A
|-
| 2 || A || 3
|-
| 5 || C || B
|-
| 4 || E || 1
|}
Numbers Letters Mix
1 B 2
3 D A
2 A C
5 C B
4 E 1
Etrian Odyssey Wiki help pages
Basic editing Getting started (To-do list) • Talk pagesProtected pagesImages (Image sourcing) • Moving pagesRedirectsReferencesTablesTemplates (Formatting templates) • Userboxes (list) • Help pages on MediaWiki.org
Guidelines and policies User accountsCoverage policyQuality standardsFile policiesInterwiki policyCopyrightsPrivacy policyGeneral disclaimer
Advanced editing HTML in wikitextCustom signaturesArchiving talk pagesAdministrators' guide
Other information AdministratorsUser rightsAffiliatesAbout