Portal:Writing Tables in Wikicode

So, you want to write a table in wikicode/source mode? This is going to be a small, terse guide to writing a table.

Every table starts and ends with the same blocks of code: it opens with a curlybracket-pipe combo  and closes with the reverse pipe-curlybracket. The first line of the table, where it opens, also contains the definitions for how the table will look like; to get the standard table look as seen on the wiki, you should write  (other alignment options are also   and  ; the   block can take nearly any CSS code you give to it, but it has to be surrounded by quotation marks if there are more than two elements, like so:  ).

Think of tables in terms of cells arranged in rows and columns. After the opening line, you begin with column one, row one. Each cell needs to start with either a single pipe  or an exclamation mark. Pipe cells are light and have a normal font, and exclamation cells are darker and have a bold font. Each new cell should be on a new line of code. Adding new cells adds them to the current row. To end the current row and start writing cells in the next row, you need to use a pipe-dash combo  on a new line, and afterwards the next cell you add will be in the first column of the next row.

Sometimes you want to make a cell span several columns or rows, or add special styling to it. You do this by writing  or , or combine them both with  ; adding CSS is also easy and done the same way:. You can have as many style options and properties as you'd like, but they have to be separated from the text contents of the cell by a single pipe.

If your cell spans several columns, every new cell will be counted as on that many rows later: if the row starts with a cell, the next cell will be in the fourth column.

The same goes for row-spans: if your cell spans two rows, that position is considered occupied in the next row. Writing cells to the next row will skip those columns that the aforementioned cell occupies. See the code of the following table:

The 2nd row only has 3 cells written in it, but the 3rd cell from the 1st row is considered to occupy that position in row 2 as well.

You can also define multiple cells of a single row on one line; you do this by separating them with a double pipe. Do note that all the cells will "inherit" the looks of the first cell in that row: if the first cell was an exclamation cell, all the cells on that line written with two pipes will also be exclamation cells. You can even combine that with the special styling by adding it after the double pipes. An example such row might be:. This writes three exclamation cells to the current row, with all three spanning a different amount of rows. See it in action:

You can also, confusingly, style row-breaks. If you want to have a hard line between rows, try this code between two rows:. See it in action in the above table:

These simple tools are basically all you need to write a table in code.