Help:Tables

Tables are a good way to present data more complex than a simple list. Although there is a lot of wikicode which can be used for creating and formatting tables on StrategyWiki, you generally only need to know a small subset to be able to deal with most situations.

Simple tables
A simple table will just have a header row, and then rows full of data below.


 * The same table, but with the cell data compressed so that the wikicode occupies less space.
 * Table with a caption, describing what the table shows. There can only be one caption per table, and its row starts with a " |+ ".
 * You can also have header cells in each row, for example, if the first cell of each row is a heading for that row. Such header cells still begin with a " ! ".
 * }
 * Table with a caption, describing what the table shows. There can only be one caption per table, and its row starts with a " |+ ".
 * You can also have header cells in each row, for example, if the first cell of each row is a heading for that row. Such header cells still begin with a " ! ".
 * }
 * You can also have header cells in each row, for example, if the first cell of each row is a heading for that row. Such header cells still begin with a " ! ".
 * }
 * You can also have header cells in each row, for example, if the first cell of each row is a heading for that row. Such header cells still begin with a " ! ".
 * }
 * }
 * }
 * }

prettytable
You may have noticed the prettytable template at the top of each of those tables. This template should be put at the top of every data table you create, as it styles the table correctly, and allows you to do some nice things.

Sortable tables
If your table contains a lot of numeric information, or things which the reader may want to look at in alphabetic order, you can put the "|sortable=1" parameter into the prettytable at the top of your table, and headings at the top of the table will acquire sort buttons. For example:

Narrow/Floated tables
By default, prettytable will make your table occupy the full width of the page (or its container). In most cases, this is what you want, but if you're floating a table off to one side, you may want it to occupy as little width as possible. For this, you can use the "|notwide=1" parameter for prettytable, but if you're floating the table, you can instead use the "|float=left" or "|float=right" parameters, which will implicitly make the table narrow.

However, there may be other cases where you're not floating a table, but you do want it narrow. In such cases, put the "|notwide=1" parameter into the prettytable at the top of your table.

Text centering
Usually, text should be left-aligned in a table, but if (for example), the table contains lots of images, which would look better center-aligned, put the "|text center=1" parameter into the prettytable at the top of your table, and all the contents will be center-aligned.

More flexibility
If you know CSS, or want more information about the parameters for prettytable, they're described in detail in its documentation.

Advanced tables
If you want more control over your tables, see the page on advanced tables.