Tables
-
- Last edited 6 years ago by Florian Bäckmann
-
-
- No status information
Contents
Here we describe the editing of tables in the wiki code. For fast editing of tables, the WYSIWYG editor is recommended. Nevertheless, in some cases, the classic editing with wiki tags may be necessary.
Functionality
Tables are a very important tool for designing wiki pages. Besides from displaying content in a structured way, tables occasionally are used to design whole pages. The basic structure of the main page or the topic portal page for example are based on a table. However, tables should only be used very carefully to structure entire pages. The source code quickly becomes confusing for outsiders and for the reading devices of the visually impaired, they represent a barrier. Therefore, Wikipedia advises their users quite fundamentally from using tables as a graphical element for entire pages.
MediaWiki has its own syntax for displaying tables. This syntax is similar to common HTML but much simpler.
Nevertheless, the editing of tables remains complex. The use of editors produces HTML code that is a barrier to editing by others.
Simple tables
More complex tables
A Wikipedia article about this can be found here: [1]
Borders
Input | Result | Comment | ||||
---|---|---|---|---|---|---|
{| border="1" | Cell 1 | Cell 2 |- | Cell 3 | Cell 4 |} |
|
The border must be set in the first line of the table (directly after the | ||||
Note: The classic table borders may look a little old-fashioned. Therefore there you can use layout templates for your tables. |
Title rows
Input | Result | Comment | ||||||
---|---|---|---|---|---|---|---|---|
{| |- ! Last Name ! First Name |- | Karstadt | Liesl |- | Valentin | Karl |} |
|
Title rows are specified with |
Combining cells: rowspanning and rolspanning
Input | Result | Comment | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
{| |- ! A ! B ! C |- | Cell 1 | colspan="2" align="center"|Cell 2 |- | Cell 3 | Cell 4 | Cell 5 |} |
|
This is a table containing a cell which spans tow columns. The command | |||||||||
{| |- ! A ! B |- | rowspan="2" align="center"|Cell 1 | Cell 2 |- | Cell 4 |} |
|
A Table containing a cell which spans two rows ( | |||||||||
Note: Empty cells won't get a border automatically. In some browsers you can force a border with a nonbreaking space inside these cells. |
Nested tables
Input | Result | Comment | |||||
---|---|---|---|---|---|---|---|
{| border="1" |- | Cell 1 | {| border="1" | Cell A |- | Cell B |} | Cell 3 |} |
|
A table inside another table. To nest tables simply use an additional opening |
Caption
Input | Result | Comment | ||||
---|---|---|---|---|---|---|
{| |+ This is a nice table |- | Table | nice |- | Nice | table |} |
|
It is possible to add a centered caption above the table with |
Lists
Input | Result | Comment | ||||
---|---|---|---|---|---|---|
{| |- | Right listing | Wrong listing |- | * first entry * second entry | * first entry * second entry |} |
|
The list entries have to start in a new line. Otherwise an asterix will be rendered instead of a bullet symbol. |
Sortable tables
Input | Result | Comment | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
{| class="sortable" |- ! Col 1 ! Col 2 ! Col 3 |- | 12346 | € 234,44 | SuSe |- | 98765 | € 77,55 | IBM |} |
|
With | |||||||||
Limitations:
|
Column widths
Input | Result | Comment | ||||||
---|---|---|---|---|---|---|---|---|
{| |- ! width="10%"|10 % ! width="20%"|20 % ! width="40%"|40 % |- valign="top" |A |B |C |} |
|
Column widths can be specified relative and absolute, with absolute values in pixels only being used when embedding graphics. The width specification is necessary and useful only for one cell of the column. | ||||||
{| |- ! width="50"|50 ! width="100"|100 ! width="200"|200 |- |A |B |C |} |
|
Cell spacing with cellspacing and cellpadding
Input | Result | Comment | ||||||
---|---|---|---|---|---|---|---|---|
{| cellspacing="9" cellpadding="0" border="1" |- | Alpha | Beta | Gamma |- | Delta | Epsilon | Zeta |} |
|
With cellspacing the distance between the cells can be determined. The larger the cellspacing value, the wider the bridge between the cells. With cellpadding one determines the distance of the cell contents from the cell frame. | ||||||
{| cellspacing="0" cellpadding="9" border="1" |- | Alpha | Beta | Gamma |- | Delta | Epsilon | Zeta |} |
|
Alignment
Input | Result | Comment | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| cellspacing="0" border="1" |- ! width="25%"| ! width="25%" align="left"|left ! width="25%" align="center"|centered ! width="25%" align="right"|right |- valign="top" ! height="38"|top | align="left"|xx | align="center"|xxx | align="right"|xx |- valign="middle" ! height="38"|middle | align="left"|x | align="center"|x | align="right"|x |- valign="bottom" ! height="38"|bottom | align="left"|x | align="center"|x | align="right"|x |} |
|
Just as in HTML, you can align the contents of cells in the table differently. You can assign the attributes to individual cells or entire lines. The valign applies to the entire line, the align only to the respective cell. |
Formatvorlagen
Eingabe | Ergebnis | Kommentar dazu | ||
---|---|---|---|---|
File:HilfeTabelle16.jpg |
|
Einige Benutzer haben Vorlagen erstellt, um die Formatierung zu vereinfachen. Anstatt sich an die Tabellenparameter erinnern zu müssen, kann eine Formatvorlage verwendet werden. Diese ist nach dem |