Help:Table editing

From Guild Wars Wiki
Jump to: navigation, search
What is a table?

A table is a method for organizing data by arranging it in columns and rows. It provides a compact way to view data, while also allowing comparisons and sorting.

How to use a table

Here is an example of a basic table.

{|
|-
! header 1
! header 2
! header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}

The above example gives you a table that looks like this:

header 1 header 2 header 3
row 1, cell 1 row 1, cell 2 row 1, cell 3
row 2, cell 1 row 2, cell 2 row 2, cell 3


Rows and columns

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:

{|
  table code goes here
|}

Every new row of a table must begin with a pipe and a hyphen |- on its own line.

There are two ways to add a cell to each row. Either make a new line and start it with a pipe | or put two pipes || between each cell. The following example shows how both are used for the same result.

{|
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell A 
|Cell B
|Cell C
|}

Creates:

Cell 1 Cell 2 Cell 3
Cell A Cell B Cell C

Formatting

There are three ways to add formatting to a table: apply it to a whole table, apply it to a single row, or apply it to a single cell. Table formatting requires a little html knowledge.

Whole table

On the first line of your table, after the {| you can specify some properties of your table. For example, add a border to your table.

{| border = "1"
|-
|data1 || data2
|-
|data3
|data4
|}

Creates:

data1 data2
data3 data4

Single row

On the line declaring each new row |- you can specify properties of that line. For example, to change the background color of a row.

{|
|-
|data1 || data2
|- style="background:red"
|data3
|data4
|}

Creates:

data1 data2
data3 data4

Single cell

For each cell of a table, you can specify additional properties that only apply to that cell. To do that you need to add formatting | to the front of each cell you want to change.

{|
|-
| style="background:red" | data1 || style="background:blue" | data2
|- 
|data3
|style="background:yellow" |data4
|}

Creates:

data1 data2
data3 data4

Notice that if you use the double pipes || to separate your cells, the additional cell formatting comes after the double pipe and does not replace it.

GWW standard formatting

In many cases you will want your tables to look consistent with other tables on GWW. A template has been provided that will apply the styles to the whole table.

{| {{STDT}}
|-
|data1 || data2
|-
|data3
|data4
|}

Creates:

data1 data2
data3 data4

For more information on how to use the template, go to {{STDT}}.

Advanced

For more information on how to use tables, go to the Help:Table at wikimedia.