Welcome to Warhammer 40k - Lexicanum! Log in and join the community.

Warhammer 40k - Lexicanum:Tables Help

From Warhammer 40k - Lexicanum
Jump to: navigation, search
Helpful Articles
ServiceImage.jpg

This article is designed to be a How to guide for creating tables using wiki formating.

Table Elements

Creating a Table

  1. {| Curly Bracket followed by a Pipe is used to indicate the beginning of a table.
  2. | a Pipe, on a new line, is used to indicate the first cell of a table.
  3. |} a Pipe followed by a Curly Bracket is used to indicate the end of a table.

Example:

{|

| Text in first cell
|}

 produces: 
Text in first cell

Table Caption

To add a caption for a table, use a Pipe followed by a Plus |+ as the 1st line in the table.

Example:

{|

|+ Table Caption
| Text in first cell
|}

 produces: 
Table Caption
Text in first cell

Add a Border

To add a border to a table, on the first line after the Curly Bracket and Pipe, type border="1". The higher the number the broader the border.

Example:

{|border="1"

|+ Table Caption
| Text in first cell
|}

 produces: 
Table Caption
Text in first cell

Additional Horizontal Cells

To add additional horizontal cells, place a Pipe | on a new line.

Example (a table with 3 horizontal cells):

{| border="1"

|+ Table Caption
| Cell 1
| Cell 2
| Cell 3
|}

 produces: 
Table Caption
Cell 1 Cell 2 Cell 3

Additional Rows

To add a row, on a new line, add a Pipe followed by a Hyphen |-. Then place a Pipe on the next line for the first cell in the new row.

Example:

{| border="1"

|+ Table Caption
| Row 1, Cell 1
| Row 1, Cell 2
| Row 1, Cell 3
|-
| Row 2, Cell 1
| Row 2, Cell 2
| Row 2, Cell 3
|-
| Row 3, Cell 1
| Row 3, Cell 2
| Row 3, Cell 3
|}

 produces: 
Table Caption
Row 1, Cell 1 Row 1, Cell 2 Row 1, Cell 3
Row 2, Cell 1 Row 2, Cell 2 Row 2, Cell 3
Row 3, Cell 1 Row 3, Cell 2 Row 3, Cell 3

Row and Column Headers

To make a cell a row or column header, use an Exclamation Point ! instead of a Pipe.

Example:

{| border="1"

|+ Table Caption
|
! Column 1 Header
! Column 2 Header
|-
! Row 1 Header
| Row 1, Cell 1
| Row 1, Cell 2
|-
! Row 2 Header
| Row 2, Cell 1
| Row 2, Cell 1
|}

 produces: 
Table Caption
Column 1 Header Column 2 Header
Row 1 Header Row 1, Cell 1 Row 1, Cell 2
Row 2 Header Row 2, Cell 1 Row 2, Cell 2

Cell Alignment

Cells can be aligned to be right-justified, centered, or left justified. They can also be vertically aligned to shift to the top, bottom or be centered. By default, cells are left-justified and vertically centered.
Left justification
To left-justify a cell, after the Pipe place the text align="left" followed by another Pipe. This is usually not necessary, as the default is to left-justify.
Centered
To center a cell, after the Pipe place the text align="center followed by another Pipe.
Right Justification
To right-justify a cell, after the Pipe place the text align="right" followed by another Pipe.
Vertical Top Alignment
To vertically align the text at the top of the cell, after the Pipe place the text valign="top" followed by another Pipe.
Vertical Middle Alignment
To vertically center the text in a cell, after the Pipe place the text valign="middle" followed by another Pipe. This is not normally necessary as middle alignment is the default.
Vertical Bottom Alignment
To vertically align the text to the bottom of the cell, after the Pipe place the text valign="bottom" followed by another Pipe.

Example:

{| border="1"

|+ Table Caption
|
! Column 1 Header
! Column 2 Header
|-
! Row 1 Header
| align="right" | Row 1, Cell 1
| align="center" | Row 1, Cell 2
|-
! Row 2 Header
| Row 2, Cell 1
| valign="top" |Row 2, Cell 1
|-
! Row 2 Header
| Row 3, Cell 1
| valign="bottom" |Row 3, Cell 1
|}

 produces: 
Table Caption
Column 1 Header Column 2 Header
Row 1 Header Row 1, Cell 1 Row 1, Cell 2
Row 2 Header Row 2, Cell 1 Row 2, Cell 2
Row 3 Header Row 3, Cell 1 Row 3, Cell 2

Cell Color

To make the background of a cell a different color, place the following after the Pipe for the cell: "bgcolor=#CCCCCC".
The color code is a number sign '#' followed by three hexadecimal numbers. The first number is the Red value, the second is the Blue value, and the third is the Green value. The larger the number the brighter the color.

Example:

{| border="1"

|+ Table Caption
|
! Column 1 Header
! Column 2 Header
|-
! Row 1 Header
|bgcolor=#00ffff| Row 1, Cell 1
| Row 1, Cell 2
|-
! Row 2 Header
|Row 2, Cell 1
| Row 2, Cell 1
|}

 produces: 
Table Caption
Column 1 Header Column 2 Header
Row 1 Header Row 1, Cell 1 Row 1, Cell 2
Row 2 Header Row 2, Cell 1 Row 2, Cell 2


Column Span

To make the cell span more than one column, place the following after the Pipe for the cell: "colspan="#" (with # being the number of columns to span).".

Example:

{| border="1"

|+ Table Caption
|
! Column 1 Header
! Column 2 Header
|-
! Row 1 Header
|colspan="2"| Row 1, Cell spans 1 & 2
|-
! Row 2 Header
|Row 2, Cell 1
| Row 2, Cell 1
|}

 produces: 
Table Caption
Column 1 Header Column 2 Header
Row 1 Header Row 1, Cell spans 1 & 2
Row 2 Header Row 2, Cell 1 Row 2, Cell 2


Terms

  • Curly Bracket: { }
  • Exclamation Point: !
  • Hyphen: -
  • Number Sign: #
  • Plus: +
  • Pipe: |


Related Articles