Wikia

WoWWiki

Help:Table

Talk4
101,388pages on
this wiki
HELP CONTENTS · Getting Started · New to WoWWIKI · Editing WoWWIKI · Editing WoWWIKI (advanced)
The WoWWIKI Community · Additional Help · Mists-Logo-Small Updating for Mists of Pandaria
See Wikia Help for general Wikia- and wiki- related help. See Metawiki logo 18x18 Meta-Wiki HelpIntro for basic MediaWiki usage!

MediaWiki supports different types of table syntax:

  1. Limited HTML syntax
  2. Pipe syntax (which this article covers)

See the Wikipedia article on HTML elements for notes on traditional HTML. Note, however, that the thead, tbody, tfoot, and colgroup elements are currently not supported in MediaWiki.[1]

The pipe syntax substitutes pipes (|) for HTML. The pipes must start at the beginning of a new line, except when separating optional parameters from content or when using || to separate cells on a single line.

Example table Edit

{|
|-
! Header 1
! Header 2
! Header 3
|-
| row 1, cell 1
| R1/C2
| Cell 3
|-
| row 2, cell 1 || R2/C2 || Cell 3
|}

Would look like this:

Header 1 Header 2 Header 3
row 1, cell 1 R1/C2 Cell 3
row 2, cell 1 R2/C2 Cell 3

TablesEdit

Use {| to open a table, and |} closes a table. Parameters (such as align, style, etc.) can be assigned added after the opening brackets.

Please use {| class="darktable" in WoWwiki tables to make them all purty-like:

Header 1 Header 2 Header 3
row 1, cell 1 R1/C2 Cell 3
row 2, cell 1 R2/C2 Cell 3

Note how each column automatically adjusts to the width of its widest cell.

CaptionsEdit

Captions are the name of the table, centered just above it, and are created by adding a line with |+ (plus desired parameters) just after the table-opening line. |+ Put Caption Here produces:

Put Caption Here
Header 1 Header 2 Header 3
row 1, cell 1 R1/C2 Cell 3
row 2, cell 1 R2/C2 Cell 3

RowsEdit

Rows are created with |-. Rows do not get closed; either start a new row or end the table.

Parameters added here will affect all cells in the row. |- align="right" for the 2nd row produces:

Header 1 Header 2 Header 3
row 1, cell 1 R1/C2 Cell 3
row 2, cell 1 R2/C2 Cell 3

CellsEdit

Cells can be entered in two formats. On separate lines, as in row 1 of our example table; or all on one line, as in row 2.

Parameters only affect their cell, and can be used in both formats:

|param="<value>"|Cell1
|param="<value>"|Cell2

or

|param="<value>"|Cell1||param="<value>"|Cell2

Like rows, cells are not closed; simply start a new row or close the table.

Cell Parameters (note that cell parameters will override any conflicting row parameters):

  • style: values can be "background-color:<color>", where <color> is a word, such as gray or red.
  • width: values can be "<x>px" where <x> is the number of pixels.
  • rowspan and colspan: values can be "<x>" where <x> is the number of columns or rows to span. Most commonly used in headers, this allows a cell to span multiple rows or columns, starting in the current row or column.
  • bgcolor: values can be "#<rr><gg><bb>", where the variables are values 00 thru FF, hexadecimal values for the red (<rr>), green (<gg>), and blue (<bb>) values of the desired color.

Example:

!style="background-color:gray;" width="300px"|Header 1!!bgcolor="#FF0000" colspan="2"|Header 2

HeadersEdit

Headers are simply the top-most cells in a column, or the left-most cells in a row. They describe the contents of that column or row. They use ! instead of the | used for regular cells, but parameters still use "|".

Like normal cells, headers can be listed on separate lines (as in our example table), or all on one line:

!Header 1!!Header 2!!Header 3

SortingEdit

Columns on a table are made sortable by adding a class at the table opening: {| class="sortable"

Example Sortable Table
Alphabetical Numerical Reputation Surname
A 4 2 Revered Kir James T Kirk
C 3 3 Honored Rod Gene Roddenberry
B 2 4 FriendlyAnd John Anderson
D 1 1 Exalted Aze Bill Azeroth

Vic The Reputation column uses hidden, non-displaying numbers to determine sort order:

<span style="display:none">#</span>

Non-displaying letters can also be used to sort a list by surname if desired. For long lists, you should include at least the first few letters for sub-sorting names that start with the same letter.

<span style="display:none">Aze</span> Bill Azeroth

Striped tablesEdit

In long tables, or in tables with multi-line rows, it may be desirable to visually distinguish rows. This is accomplished by making every other row use a different background with class="zebra" at the start:

{| class="darktable zebra"

This also works for sortable tables. The zebra tag ensures that the rows have alternating colors, even when the order of the rows is changed by sorting.

Example Striped Table
Alphabetical Numerical Reputation Surname
A 4 2 Revered Kirk
(James T.)
C 3 3 Honored Roddenberry
(Gene)
B 2 4 Friendly Anderson
(John)
D 1 1 Exalted Azeroth
(Bill)

You can also manually control the striping by using class="alt" at the beginning of the desired rows:

|-class="alt"

Rows with this tag will have the alternative color. This method is only advisable for non-sortable tables.

References Edit

External linksEdit


 

Tables are a great tool to help organize your pages to display data, facts and other information. Tables can be created both in the editor's visual mode and via wikitext.

Step by step

To create a table a click on the table button Table button on the right rail of the editor's visual mode.

Edit toolbar table highlighted

Click the table button

1. In edit mode, click on the table button under the "Insert" section of the editing toolbar.

2. A popup box will appear, and allow you to choose the parameters you want for your table.

Table properties

Create your table

3. Once you click ok, a table will appear in your text. You can now input content.

4. Should you need to change the table parameters, simply right click, and make the needed changes.

Table editor

Right click to edit

Editing tables in source mode

If you are an advanced editor, you can learn how to edit a table in source mode by checking out these examples: Help:Wikitext/table examples. Via wikitext, you can:

  • Make a table sortable by column, and collapsible
  • Vertically align cells and rows
  • Make cells span columns or rows
  • Color the background of cells, rows, or the whole table with CSS

See also

Further help & feedback

Around Wikia's network

Random Wiki