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 " |+ ".
 * 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 " ! ".
 * }
 * Table with a caption, describing what the table shows. There can only be one caption per table, and its row starts with " |+ ".
 * 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 " ! ".
 * }
 * 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 " ! ".
 * }
 * 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 " ! ".
 * }
 * }
 * }
 * }

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. To add parameters to the  template, separate them with "|" characters.

Ex.:

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 " " parameter into the prettytable at the top of your table.. This makes headings at the top of the table acquire sort buttons. To suppress sorting for a single column, use the nosort template in that header cell.

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 it creates undue whitespace in the table, or you are putting multiple tables side-by-side in columns, you may want it to occupy as little width as possible. For this, you can use the " " parameter for prettytable. If you're floating the table to the left or right, which allows text and other content to flow around it, you can instead use the " " or " " parameters, which will implicitly make the table narrow.

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 " " 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. You can add table styles through the template by using the " " parameter. Note that quotes are not put around the styles.

Advanced tables
If you want more control over your tables, see the ../Advanced tables/ page. Note that it's discouraged for tables in general to use custom styling, as it breaks from the consistency of the site. If you want to change the styling of tables in your guide, talk to a sysop.