User:KenWalker/table
Appearance
Table
[edit]Basic table syntax
[edit]The following elements are delimited by line breaks, exceptions noted,
Element | What it does |
---|---|
{| optional table parameters
|
start table |
|+ caption text
|
caption, (optional but must be placed immediatly after {| if used)
|
|- optional row parameters
|
new row |
| cell text
|
new cell |
|| cell text
|
new cell on same line in the code |
| cell parameters | cell text
|
new cell (with parameters) |
|| cell parameters | cell text
|
new cell (with parameters) on same line in the code |
! heading text
|
new heading |
!! heading text
|
new heading on same line in the code |
! heading parameters | heading text
|
new heading (with parameters) |
!! heading parameters | heading text
|
new heading (with parameters) on same line in the code |
|}
|
end table |
Example:
|
{| |+ This is the caption ! !! Column 1 !! Column 2 !! Column 3 |- ! Row 1 | 1,1 || 1,2 || 1,3 |- !Row 2 | 2,1 | 2,2 | 2,3 |} |
Basic Parameters
[edit]Basic Table Parameters
[edit]Parameter | What it does |
---|---|
border = value px |
specifies the border width in pixels |
cellpadding = value px |
specifies cell padding in pixels |
cellspacing = value px |
specifies cell spacing in pixels |
width = value px/value% |
specifies table width in pixels or as a percent |
align = left/right/center |
specifies table alignment |
Example:
{|border = 3 px cellpadding = 3 px cellspacing = 3 px width = 60% align = center ! !! Column 1 !! Column 2 !! Column 3 |- ! Row 1 | 1,1 || 1,2 || 1,3 |- !Row 2 | 2,1 || 2,2 || 2,3 |}
Result:
Column 1 | Column 2 | Column 3 | |
---|---|---|---|
Row 1 | 1,1 | 1,2 | 1,3 |
Row 2 | 2,1 | 2,2 | 2,3 |
Basic Row Parameters
[edit]bgcolor = color |
specifies cell background color for the row |
Basic Cell Parameters
[edit]width = value px/value% |
specifies cell width in pixels or as a percent |
align = left/right/center |
specifies cell text alignment |
bgcolor = color |
specifies cell background color |
rowspan = value |
specifies number of rows the cell will span |
colspan = value |
specifies number of columns the cell will span |
Style Parameters
[edit]Junk
[edit]class
[edit]class - an easy way to instantly improve the look of a table is to give it a class. Available classes include "wikitable" and wikitable small".
Example:
{| class = "wikitable" |+ This is the caption ! !! Column 1 !! Column 2 !! Column 3 |- ! Row 1 | 1,1 || 1,2 || 1,3 |- !Row 2 | 2,1 | 2,2 | 2,3 |}
Result:
Column 1 | Column 2 | Column 3 | |
---|---|---|---|
Row 1 | 1,1 | 1,2 | 1,3 |
Row 2 | 2,1 | 2,2 | 2,3 |
style
[edit]height
Column 1 | Column 2 | Column 3 | |
---|---|---|---|
Row 1 | 1,1 | 1,2 | 1,3 |
Row 2 | 2,1 | 2,2 | 2,3 |