Help:Tables

Introduction
In Halopedia you can create a table by using the HTML code. However, Halopedia offers a simpler way to create a table. If you have a table in HTML that you want to convert to a wiki-table please refer to the Wiki-Table generators.

Pipe syntax tutorial
The Wiki table using the | or pipe sign as a way to create a table. Below is an example and explanation of how to create a table. The final table would display like this:  The table parameters and cell parameters are the same as in HTML, see  and  HTML element#Tables.
 * The entire table is encased with curly brackets and a vertical bar character (a pipe). So use   to begin a table, and   to end it.  Each one needs to be on its own line:
 * An optional table caption is included with a line starting with a vertical bar and plus sign " " and the caption after it:
 * To start a new table row, type a vertical bar and a dash on its own line: " ". The codes for the cells in that row will start on the next line.
 * Type the codes for each table cell in the next row, starting with a bar:
 * Cells can be separated with either a new line and new bar, or by a double bar "||" on the same line. Both produce the same output:
 * a row of column headings is identified by using "!" instead of "|", and using "!!" instead of "||". Header cells typically render differently than regular cells, depending on the browser.  They are often rendered in a bold font and centered.
 * the first cell of a row is identified as row heading by starting the line with "!" instead of "|", and starting subsequent data cells on a new line.
 * Optional parameters can modify the behavior of cells, rows, or the entire table. For instance, a border could be added to the table:

A table can be useful even if none of the cells have content. For example, the background colors of cells can be changed with cell parameters, making the table into a diagram, like m:Template talk:Square 8x8 pentomino example. An "image" in the form of a table is much more convenient to edit than an uploaded image.

Each row must have the same number of cells as the other rows, so that the number of columns in the table remains consistent (unless there are cells which span several columns or rows, see colspan and rowspan in M&#233;lange example below). For empty cells, use the non-breaking space  as content to ensure that the cells are displayed. To show a visible pipe in a cell, use &lt;nowiki>|&lt;/nowiki> or &amp;#124;.

Simple example
Both of these generate the same output. Choose a style based on the amount of cells in each row and the total text inside each cell. Wiki markup   What it looks like in your browser 

Multiplication table
Wiki markup  What it looks like in your browser 

Color; scope of parameters
Two ways of specifying color of text and background for a single cell are as follows. The first form is preferred: Wiki markup  What it looks like in your browser 

Like other parameters, colors can also be specified for a whole row or the whole table; parameters for a row override the value for the table, and those for a cell override those for a row: Wiki markup  What it looks like in your browser 

To make the table blend in with the background, use. (Warning:, does not work with some browsers, including IE6!)

Width, height
The width and height of the whole table can be specified, as well as the height of a row. To specify the width of a column one can specify the width of an arbitrary cell in it. If the width is not specified for all columns, and/or the height is not specified for all rows, then there is some ambiguity, and the result depends on the browser. Wiki markup  What it looks like in your browser 

Note that inline CSS  has no effect with some browsers. If it's important equivalent older constructs like  should work on more browsers.

Setting your column widths
If you wish to force column widths to your own requirements, rather than accepting the width of the widest text element in a column's cells, then follow this example. Note that wrap-around of text is forced. <blockquote style="background: white; border: 1px solid black; padding: 1em;"> <blockquote style="background: white; border: 1px solid black; padding: 1em;">

Positioning
One can position the table itself, and all contents in a row, and contents in a cell, but not with a single parameter all contents in the table. Do not, under any circumstances, use "float" to position a table. It will break page rendering at large font sizes.

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. Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

Floating table
Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> This paragraph is before the table. Lorem ipsum ... Note the floating table to the right. This paragraph is after the table. Lorem ipsum ... What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> This paragraph is before the table. Lorem ipsum ...

Note the floating table to the right. This paragraph is after the table. Lorem ipsum ...

Nested tables
This shows one table (in blue) nested inside another table's cell2. Nested tables have to start on a new line. Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> {| border="1"
 * &alpha;
 * align="center" | cell2


 * valign="bottom" | the original table again
 * }

Combined use of COLSPAN and ROWSPAN
Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

Centering tables
Centered tables can be achieved, but they will not "float"; that is to say, no text will appear to either side. The trick is  {| style="margin: 1em auto 1em auto" </tt>

Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

Setting parameters
At the start of a cell, add your parameter followed by a single pipe. For example width=300px|</tt> will set that cell to a width of 300 pixels. To set more than one parameter, leave a space between each one.

Wiki markup
<blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

What it looks like in your browser
<blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

Decimal point alignment
A method to get columns of numbers aligned at the decimal point is as follows: Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;">

If the column of numbers appears in a table with cell padding or cell spacing, one can still align the decimal points without an unsightly gap in the middle. Embed a table in each number's cell and specify its column widths. Make the embedded tables' column widths the same for each cell in the column. (If decimal points are still misaligned using this method, the main table's column may be too narrow. Add a parameter to increase the column's width.) Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> {|border="1" cellpadding="4" cellspacing="2" width="72"





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
 * }

Style classes
Some users have created CSS classes and templates to make table styles easier. Instead of remembering table parameters, you just include an appropriate style class after the. This helps keep table formatting consistent, and can allow a single change to the class to fix a problem or enhance the look of all the tables that are using it at once. For instance, this: simply by replacing the parameters of the table ( or the like) with    This is because the wikitable class in MediaWiki:Common.css contains a number of table.wikitable CSS style rules. These are all applied at once when you mark a table with the class. You can then add additional style rules if desired. These override the class's rules, allowing you to use the class style as a base and build up on it: Wiki markup <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> What it looks like in your browser <blockquote style="background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;"> Notice that the table retains the gray background of the wikitable class, and the headers are still bold and centered. But now the text formatting has been overridden by the local style statement; all of the text in the table has been made italic and 120% normal size, and the wikitable border has been replaced by the red dashed border.