Formatting Tables on Wiki Pages

You can either use normal HTML tables, or you can use the wiki table language. Some people "grew up" with HTML, so they find it more natural to use, but for a novice, the wiki style is probably easier (i.e., both for creation and for maintenance). See examples below, and take your pick.

Heading styles ("TH" in HTML, "!" in wiki) are usually displayed in bold. The regular text ("TD" in HTML, "|" in wiki) is not.

The examples below should get you started.

Note that there are many more options than are described here (e.g., column widths, effects), so see the references below for how to use the options:

https://www.mediawiki.org/wiki/Help:Tables
https://en.wikipedia.org/wiki/Help:Table
https://en.wikipedia.org/wiki/Help:Wikipedia:_The_Missing_Manual/Formatting_and_illustrating_articles/Creating_lists_and_tables#Editing_and_creating_tables

As always, you can experiment in the BAOC Sandbox if you like.

HTML Format

Putting the following on a wiki page:

<TABLE border="1">
<CAPTION>The Table Caption</CAPTION>
<TR><TH>Column heading 1</TH><TH>Column heading 2</TH><TH>Column heading 3</TH></TR>
<TR><TH>Row heading 1</TH><TD>Cell 2</TD><TD>Cell 3</TD></TR>
<TR><TH>Row heading A</TH><TD>Cell B</TD><TD>Cell C</TD></TR>
</TABLE>

results in this output:

The Table Caption
Column heading 1Column heading 2Column heading 3
Row heading 1Cell 2Cell 3
Row heading ACell BCell C

Note: You do not need to put <HTML> and </HTML> tags around the table. If those tags are omitted, normal wiki text formatting can be used in the table. If those tags are included, HTML text formatting must be used in the table.

If you don't want the row headings to be bold, replace <TH> and </TH> with <TD> and </TD>, respectively, for each row. If you don't want borders around the cells, omit the "border" parameter.

All the normal HTML options for formatting tables are available.

A blank line is always output above and below the table. Unlike the wiki-formatted form below, however, additional blank space will not be displayed if the wiki content includes a blank line before or after the lines that define the table.

If a column width is not specified, the column width is determined by the longest entry in the column. In that case, if you want to make a column wider, you can put one or more HTML non-breaking-space characters ("&nbsp;") before and/or after the longest cell text. Experiment.

WIKI Format

Putting the following on a wiki page:

{| border="1"
|+ The Table Caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
! Row heading 1
| Cell 2 || Cell 3
|-
! Row heading A
|Cell B
|Cell C
|}

results in this output:

The Table Caption
Column heading 1 Column heading 2 Column heading 3
Row heading 1 Cell 2 Cell 3
Row heading A Cell B Cell C

Note that you can put row cells on one line, or on separate lines.

If you don't want the row headings to be bold, replace "!" with "|" for each row. If you don't want borders around the cells, omit the "border" parameter.

A blank line is always output above and below the table. Unlike the HTML-formatted form above, if the wiki content includes a blank line before or after the lines that define the table, additional blank space on the displayed page will result.

The column- and row-heading cells are automatically centered (and bolded). If you want the other cells to be centered, you can specify an "align" setting for each row, as follows:

{| border="1"
|+ The Table Caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|- align="center"
! Row heading 1
| Cell 2 || Cell 3
|- align="center"
! Row heading A
|Cell B
|Cell C
|}

That results in this output:

The Table Caption
Column heading 1 Column heading 2 Column heading 3
Row heading 1 Cell 2 Cell 3
Row heading A Cell B Cell C

There are other formatting options. For example, you can disable the cell borders by changing border="1" to border="0". You can center the whole table on the page by including align="center" on the first line for the table. You can specify minimum "padding" at the left and right sides of the cells by including cellpadding="10" (or some other number) on the first line for the table.

Also, the format of individual cells can be specified. See the mediaWiki User Manual (http://www.mediawiki.org/wiki/Help:Tables) for details.

As with HTML-formatted tables, the column widths are determined by the longest entry in each column. If you want to make a column wider, you can put one or more HTML non-breaking-space characters ("&nbsp;") before and/or after the longest cell text. Experiment.