Table Markup

To create a table, you start and end a line using the table marker "||". Between those start and end markers, you can create any number of cells by separating them with "||". To get a centered cell that spans several columns, you start that cell with more than one cell marker. Adjacent lines of the same indent level containing table markup are combined into one table.

For more information on the possible markup, see HelpOnEditing.

1. Table Attributes

Apart from the option to repeat cell markers to get columns spanning several other columns, you can directly set many HTML table attributes. Any attributes have to be placed between angle brackets <...> directly after the cell marker.

The wiki-like markup has the following options:

The style stuff is all you need for styling your tables. Just use CSS formatted style there and it will be inlined in the generated HTML tag. Alternatively, the admin and the user (the admin in the theme file, the user via user preferences can extend moin's CSS by his own definitions, so users can refer to them using class or id. You can use several options at the same time by writing them one after the other within the same angle brackets (e.g. <tablestyle="..." rowstyle="..."> on the first cell, to set both the table-wide style and the first-row style).

We still support the old table markup, but generate the effect by appending additional values to the style parameter:

If you use several conflicting options like <(:)>, the last option wins. There is no explicit option for vertical centering (middle), since that is always the default.

2. Examples

2.1. General table layout and HTML like options

New Style:
||||||<tablestyle="width: 80%">'''Heading'''||
||cell 1||cell2||cell 3||
||<rowspan=2> spanning rows||||<style="background-color: #E0E0FF;"> spanning 2 columns||
||<rowstyle="background-color: #FFFFE0;">cell2||cell 3||

Old Style:
||cell 1||cell2||cell 3||
||<rowspan=2> spanning rows||||<bgcolor="#E0E0FF"> spanning 2 columns||
||<rowbgcolor="#FFFFE0">cell2||cell 3||


cell 1


cell 3

spanning rows

spanning 2 columns


cell 3

2.2. Cell width

New Style
|| narrow ||<style="width: 99%; text-align: center;"> wide ||

Old Style
|| narrow ||<:99%> wide ||



2.3. Spanning rows and columns

||<|2> 2 rows || row 1 ||
|| row 2 ||
||<-2> row 3 over 2 columns ||

2 rows

row 1

row 2

row 3 over 2 columns

2.4. Alignment

||<style="text-align: left;">left ||<style="vertical-align: top; text-align: center;"|3> top ||<style="vertical-align: bottom;"|3> bottom ||
||<style="text-align: center;"> centered ||
||<style="text-align: right;"> right ||

old style:
||<(> left ||<^|3> top ||<v|3> bottom ||
||<:> centered ||
||<)> right ||






2.5. Fonts

|| normal ||<style="font-weight: bold;"> bold ||<style="color: #FF0000;"> red ||<style="color: #FF0000; font-weight: bold;"> boldred ||





2.6. Colors

New style
||<style="background-color: red;"> red ||<style="background-color: green;"> green ||<style="background-color: blue;"> blue ||
old Style
||<#FF8080> red ||<#80FF80> green ||<#8080FF> blue ||




2.7. Line breaks within cells

|| line 1<<BR>>line 2||

line 1
line 2

2.8. No border style

||<style="border:none;"> line 1||
||<style="border:none;"> line 2||

line 1

line 2

3. Insert Table Data from other sources

4. Bulleted lists and other complex content within cells

MiniPage.png | Copyright (c) 2004-2022 czk.