Help:Tables

From GenWiki

Jump to: navigation, search

Hierarchy

Welcome > Help:Contents > Tables

Tables are a good way to display similar information in an easy to understand format, however, they are a little more complicated than normal Text. Therefore they should only be used where it is necessary to have a better way of displaying your data.


Contents

Basics

Every Table in the WIKI- Style starts with a curly brace { followed by a vertical line | and ends with another vertical line | and a curly brace }. The opening curly brace MUST be the first symbol of the line.
( Exception: Tables in the Tpewriterstyle)


Simple Tables

Tables in the Typewriterstyle without any formatting

The simpliest and fastest way to create a table is the Typewriter Style. There you start every line with an empty space. The columns and the layout will be automatically adjusted. The result will be the exact duplicate of your typing.

Sample:

Climate table
Month                    JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 
-----------------------------------------------------------------------
Ø Day temperature         21  21  22  23  24  25  27  29  28  26  24  22 
Ø Night temperature       15  15  15  16  17  18  20  21  20  19  18  16 
Ø Sun hours per day        6   6   7   8   9   9   9   9   8   7   6   5 
Ø Rainy days/ Month        6   4   3   2   2   1   0   0   2   5   6   7 
Ø Water temperature       19  18  18  18  19  20  21  22  23  23  21  20

Tables with only ONE row

Each row within the two curly brackets starts with a single pipe |. This pipe clearly indicates a new cell. Directly after this comes either the contents of the cell or a style- argument ( like rowspan, etc. see below). This single pipe can be on the start of the row or in between, however in this case there have to be TWO pipes. But it is adviceable to have it on the start of the row to have a cleaner structure of the table.

Samples: The simplest table ( containing only ONE Cell) is written like:

{|
 |Simple Table in Typewriterstyle
 |}

And it looks like this:

Simple Table in Typewriterstyle

A Table with TWO cells in ONE row is written like this: Eine Tabelle mit zwei Zellen in einer Tabellenzeile sieht im Text so aus:

{|
 |Cell 1
 |Cell 2
 |}

And looks like this:

Cell 1 Cell 2

Tables with several rows

Of course, in most cases, there are tables with several rows needed. A new row is being identified with a - behind the vertical line |. This can be repeated over and over again.

Samples:
A Table with TWO rows and TWO cells each is being written like this:

{|
 |Cell 1
 |Cell 2
 |-
 |Cell 3
 |Cell 4
 |}

And looks like this:

Cell 1 Cell 2
Cell 3 Cell 4

And a Table with THREE rows is written like this:

{|
 |Cell 1
 |Cell 2
 |-
 |Cell 3
 |Cell 4
 |-
 |Cell 5
 |Cell 6
 |}

And looks like this:

Cell 1 Cell 2
Cell 3 Cell 4
Cell 5 Cell 6

and so on.

More complex tables

Frames

So far our tables didn't have any frames. The frame has to be initiated in the first line ( directly behind the {|) and it is important to leave an space. At the moment there can only be the width of the frame specified this probably will change with later versions of WIKI). The argument is: border=n where n is the width of the frame.

Sample:
The last sample from above is being written like this:

{| border=1
 |Cell 1
 |Cell 2
 |-
 |Cell 3
 |Cell 4
 |-
 |Cell 5
 |Cell 6
 |}

and looks like this:

Cell 1 Cell 2
Cell 3 Cell 4
Cell 5 Cell 6

Colored Frames

Coming soon !

Rowspan and Columnspan

Just like it is with HTML, with the WIKI- commands you can have cells extending over severals rows and/ or columns, it is called rowspan and colspan. To initiate rowspan you have to insert the command rowspan=n ( where n is the number of rows the cell should cover) before the cell, but definitely in the same row. If a cell should cover sveral columns use the colspan command.

Sample:
A Table, where Cell 2 extends over TWO columns, is being written like this:

{| border=1
 |Cell 1 
 |rowspan=2 | Cell 2, with rowspan
 |Cell 3
 |- 
 |Cell 4
 |Cell 5
 |}

and looks like this:

Cell 1 Cell 2, with rowspan Cell 3
Cell 4 Cell 5

Nested Tables

The nesting of Tables is very easy with the WIKI commands. Wherever you want to insert a new table, just insert an opening brace {.
Important do NOT use a pipe | before the { !


Sample:
A Table, with another Table nested in it, is written like this:

{| border=1
 |Cell 1
 |
 {| border=2
 |Cell A
 |-
 |Cell B
 |}
 |Cell 3
 |}

and looks like this:

Cell 1
Cell A
Cell B
Cell 3

Description

It is also very easy to add a description to the table with the WIKI commands. The description is centered to the table and has the same width. To implement it, just add a + sign after the pipe |. Within the Description you can use the usual WIKI commands.

Sample:
A Table with a Description is written like this:

{||border=1
 |+ This is a '''Description''', which is ''verrry'' long.  
 |Cell 1
 |Cell 2
 |-
 |Cell 3
 |Cell 4
 |}

and looks like this:

This is a Description, which is verrry long.
Cell 1 Cell 2
Cell 3 Cell 4

Additional Formatting Options

Cells with colored Background

The Background color of the cells can also be changed with the bgcolor=#ABCDEF command. see also Colortable

Cells with colored Frames

Just working on it..

Floating Tables

With the align command you are able to locate your tables anywhere you want.

{| align=right border=1
| Cell 1, row 1 
|rowspan=2| Cell 2, row 1 (and 2) 
| Cell 3, row 1 
|- 
| Cell 1, row 2 
| Cell 3, row 2 
|}
Cell 1, row 1 Cell 2, row 1 (and 2) Cell 3, row 1
Cell 1, row 2 Cell 3, row 2

Note the floating table to the right.

More Options

working on it later on

An example table
First header Second header
upper left

right side

lower left lower middle
A table in a table
File:Wiki.png File:Wiki.png

Two Wikipedia logos


'Put your text here'
Personal tools
GenWiki-internal
In other languages