Help:Table

MediaWiki supports different types of table syntax:
 * 1) XHTML
 * 2) HTML and wiki  syntax
 * 3) pipe-syntax

All three are supported by MediaWiki and create valid HTML output.

See also HTML element#Tables. Note however that the,  ,  , and   elements are currently not supported in MediaWiki.

Overview
Sample table

Pros Can be previewed/debugged with any XHTML editor

Can be formatted for easier reading

Well-known

Can be previewed/debugged with any HTML editor

Can be formatted for easier reading

Well-known

Takes less space than XHTML Easy to write

Easy to read

Takes little space

Cons Tedious

Takes a lot of space

Difficult to read quickly

Confusing, especially for people with little HTML experience

Poorly formed

Poorly delimited

Generally odd looking

Unfamiliar syntax

Rigid structure

Cannot be indented

XHTML HTML &amp; Wiki-td Wiki-pipe

Guide to the pipe syntax
The pipe syntax, developed by Magnus Manske, substitutes pipes ( | ) for HTML. There is an on-line script which converts html tables to pipe syntax tables.

The pipes must start at the beginning of a new line, except when separating parameters from content or when using  to separate cells on a single line. The parameters are optional.

Tables
A table is defined by which equals and, or the first parameter gets ignored.

Rows
<tr&gt; tags will be generated automatically for the first row. To start a new row, use |- which results in &lt;tr&gt; Parameters can be added like this: |- params which results in &lt;tr params&gt;

Note:
 * <tr&gt; tags will be automatically opened at the first <td&gt; equivalent
 * <tr&gt; tags will be automatically closed at <tr&gt; and </table&gt; equivalents

Cells
Cells are generated either like this: |cell1 |cell2 |cell3 or like this: |cell1||cell2||cell3 which both equal <td&gt;cell1</td&gt;<td&gt;cell2</td&gt;<td&gt;cell3</td&gt; so "||" equals "newline" + "|"

Parameters in cells can be used like this: |params|cell1||params|cell2||params|cell3 which will result in 

Appearance


M&eacute;lange
Here's a more advanced example, showing some more options available for making up tables. You can play with these settings in your own table to see what effect they have. Not all of these techniques may be appropriate in all cases; just because you can add colored backgrounds, for example, doesn't mean it's always a good idea. Try to keep the markup in your tables relatively simple -- remember, other people are going to be editing the article too! This example should give you an idea of what is possible, though.

Source code


Appearance


Simple example
generates

Advanced example
Note the floating table to the right.

Nested table
gives a nested table

Nested tables have to start on a new line.

Text next to a table
You can use align=right, text after the table code appears to the left of the table. However, do not put preformatted text, it may overlap the table because it does not wrap.

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

To prevent this, use  :

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

Decimal point alignment
A method to get columns of numbers aligned at the decimal point is as follows:

gives

In simple cases one can dispense with the table feature and simply start the lines with a space, and put spaces to position the numbers:

432.1 43.21   4.321