Help:Table
This page is actively undergoing a major edit. As a courtesy, please do not make edits to this page while this message is displayed, in order to avoid edit conflicts. This page was last revised at 03:23, 16 May 2006 (UTC) (18 years ago). Please remove this template if it hasn't been edited for several hours. If you are the editor who added this template, please be sure to remove it or replace it with {{Under construction}} between editing sessions. Thank you. |
Introduction
This page gives you information about syntax to build wiki-tables. For large tables and complex formatting a converter program may be helpful to generate these codings. For converters please refer to Wiki-Tablegenerators. You can also use a VBA-Macro published in the german project, that converts an EXCEL-table and its format attributes.
Pipe syntax tutorial
Although HTML table syntax also works, special wikicode can be used as a shortcut to create a table. The pipe codes function exactly the same as HTML table markup, so a knowledge of HTML table code will help in understanding pipe code. The shortcuts are as follows:
- 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 |}
- An optional table caption is included with a line starting with a vertical bar and plus sign "
|+
" and the caption after it:
{|
|+ caption
table code goes here
|}
- To start a new table row, type a vertical bar and a dash on its own line: "
|-
". The codes for the cells in that row will start on the next line.
{| |+ The table's caption |- cell code goes here |- cell code goes here |}
- Type the codes for each table cell in the next row, starting with a bar:
{| |+ The table's caption |- | cell codes go here |- | cells in the next row go here | more cells in the same row here |}
- Cells can be separated with either a new line and new bar, or by a double bar "||" on the same line. Both produce the same output:
{| |+ The table's caption |- |Cell 1 || Cell 2 || Cell 3 |- |Cell A |Cell B |Cell C |}
- a row of column headings is identified by using "!" instead of "|", and using "!!" instead of "||". Header cells typically render differently than regular cells, depending on the browser. They are often rendered in a bold font and centered.
{|
|+ The table's caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell A
|Cell B
|Cell C
|}
- the first cell of a row is identified as row heading by starting the line with "!" instead of "|", and starting subsequent data cells on a new line.
{| |+ The table's caption ! Column heading 1 !! Column heading 2 !! Column heading 3 |- ! Row heading 1 | Cell 2 || Cell 3 |- ! Row heading A |Cell B |Cell C |}
- Optional parameters can modify the behavior of cells, rows, or the entire table. For instance, a border could be added to the table:
{| border="1"
|+ The table's caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
! Row heading 1
| Cell 2 || Cell 3
|-
! Row heading A
|Cell B
|Cell C
|}
The final table would display like this:
The table's caption Column heading 1 Column heading 2 Column heading 3 Row heading 1 Cell 2 Cell 3 Row heading A Cell B Cell C
The table parameters and cell parameters are the same as in HTML, see [1] and HTML element#Tables. However, the thead
, tbody
, tfoot
, colgroup
, and col
elements are currently not supported in MediaWiki.
A table can be useful even if none of the cells have content. For example, the background colors of cells can be changed with cell parameters, making the table into a diagram, like m:Template talk:Square 8x8 pentomino example. An "image" in the form of a table is much more convenient to edit than an uploaded image.
Each row must have the same number of cells as the other rows, so that the number of columns in the table remains consistent (unless there are cells which span several columns or rows, see colspan and rowspan in Mélange example below). For empty cells, use the non-breaking space
as content to ensure that the cells are displayed.
To add a visible | into a table use <nowiki>|</nowiki> or |
Examples
Simple example
Wiki markup
Both of these generate the same output. Choose a style based on the amount of cells in each row and the total text inside each cell.
{| | Cell 1, row 1 | Cell 2, row 1 |- | Cell 1, row 2 | Cell 2, row 2 |}
{| | Cell 1, row 1 || Cell 2, row 1 |- | Cell 1, row 2 || Cell 2, row 2 |}
What it looks like in your browser
Cell 1, row 1 Cell 2, row 1 Cell 1, row 2 Cell 2, row 2
Multiplication table
Wiki markup
{| class="wikitable" style="text-align:center" |+Multiplication table |- ! × !! 1 !! 2 !! 3 |- ! 1 | 1 || 2 || 3 |- ! 2 | 2 || 4 || 6 |- ! 3 | 3 || 6 || 9 |- ! 4 | 4 || 8 || 12 |- ! 5 | 5 || 10 || 15 |}
What it looks like in your browser
Multiplication table × 1 2 3 1 1 2 3 2 2 4 6 3 3 6 9 4 4 8 12 5 5 10 15
Color; scope of parameters
Two ways of specifying color of text and background for a single cell are as follows. The first form is preferred:
Wiki markup
{| | style="background:red; color:white" | abc | def | bgcolor="red" | <font color="white"> ghi </font> | jkl |}
What it looks like in your browser
abc def ghi jkl
Like other parameters, colors can also be specified for a whole row or the whole table; parameters for a row override the value for the table, and those for a cell override those for a row:
Wiki markup
{| style="background:yellow; color:green" |- | abc | def | ghi |- style="background:red; color:white" | jkl | mno | pqr |- | stu | style="background:silver" | vwx | yz |}
What it looks like in your browser
abc def ghi jkl mno pqr stu vwx yz
The HTML 4.01 specification defines sixteen named colors, here shown with hexadecimal values:
black | #000000 | silver | #c0c0c0 | maroon | #800000 | red | #ff0000 | |||
navy | #000080 | blue | #0000ff | purple | #800080 | fuchsia | #ff00ff | |||
green | #008000 | lime | #00ff00 | olive | #808000 | yellow | #ffff00 | |||
teal | #008080 | aqua | #00ffff | gray | #808080 | white | #ffffff |
See w:en:web colors. To make the table blend in with the background, use style="background:inherit"
.
Width, height
The width and height of the whole table can be specified, as well as the height of a row. To specify the width of a column one can specify the width of an arbitrary cell in it. If the width is not specified for all columns, and/or the height is not specified for all rows, then there is some ambiguity, and the result depends on the browser.
Wiki markup
{| style="width:75%; height:200px" border="1" |- | abc | def | ghi |- style="height:100px" | jkl | style="width:200px" |mno | pqr |- | stu | vwx | yz |}
What it looks like in your browser
abc def ghi jkl mno pqr stu vwx yz
Setting your column widths
If you wish to force column widths to your own requirements, rather than accepting the width of the widest text element in a column's cells, then follow this example. Note that wrap-around of text is forced.
{| border="1" cellpadding="2" !width="50"|Name !width="225"|Effect !width="225"|Games Found In |- |Pokeball |Regular Pokeball |All Versions |- |Great Ball |Better than a Pokeball |All Versions |}
Name Effect Games Found In Pokeball Regular Pokeball All Versions Great Ball Better than a Pokeball All Versions
Positioning
One can position the table itself, and all contents in a row, and contents in a cell, but not with a single parameter all contents in the table, see m:Template talk:Table demo. Do not, under any circumstances, use "float" to position a table. It will break page rendering at large font sizes.
Mélange
Here's a more advanced example, showing some more options available for making up tables. You can play with these settings in your own table to see what effect they have. Not all of these techniques may be appropriate in all cases; just because you can add colored backgrounds, for example, doesn't mean it's always a good idea. Try to keep the markup in your tables relatively simple -- remember, other people are going to be editing the article too! This example should give you an idea of what is possible, though.
Wiki markup
{| border="1" cellpadding="5" cellspacing="0" align="center" |+'''An example table''' |- ! style="background:#efefef;" | First header ! colspan="2" style="background:#ffdead;" | Second header |- | upper left | | rowspan=2 style="border-bottom:3px solid grey;" valign="top" | right side |- | style="border-bottom:3px solid grey;" | lower left | style="border-bottom:3px solid grey;" | lower middle |- | colspan="3" align="center" | {| border="0" |+''A table in a table'' |- | align="center" width="150px" | [[Image:wiki.png]] | align="center" width="150px" | [[Image:wiki.png]] |- | align="center" colspan="2" style="border-top:1px solid red; border-right:1px solid red; border-bottom:2px solid red; border-left:1px solid red;" | Two Wikimedia logos |} |}
What it looks like in your browser
An example table First header Second header upper left right side
lower left lower middle
A table in a table Two Wikimedia logos
Floating table
Wiki markup
This paragraph is before the table. Lorem ipsum ... {| align=right border=1 | Col 1, row 1 |rowspan=2| Col 2, row 1 (and 2) | Col 3, row 1 |- | Col 1, row 2 | Col 3, row 2 |} Note the floating table to the right. This paragraph is after the table. Lorem ipsum ...
What it looks like in your browser
This paragraph is before the table. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Col 1, row 1 Col 2, row 1 (and 2) Col 3, row 1 Col 1, row 2 Col 3, row 2 Note the floating table to the right. This paragraph is after the table. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nested tables
This shows one table (in blue) nested inside another table's cell2. Nested tables have to start on a new line.
Wiki markup
{| border=1 | α | align="center" | cell2 {| border=2 style="background-color:#ABCDEF;" | NESTED |- | TABLE |} | valign="bottom" | the |}
What it looks like in your browser
α cell2
NESTED TABLE the original table again
Combined use of COLSPAN and ROWSPAN
Wiki markup
{| border="1" cellpadding="5" cellspacing="0" |- ! Column 1 || Column 2 || Column 3 |- | rowspan=2| A | colspan=2 align="center"| B |- | C | D |- | E | colspan=2 align="center"| F |- | rowspan=3| G | H | I |- | J | K |- | colspan=2 align="center"| L |}
What it looks like in your browser
Column 1 Column 2 Column 3 A B C D E F G H I J K L
Default text alignment
By default, all text in table cells is left-aligned, whilst headers are centered. To change these settings for a table, use {| style="text-align:align-type" where align-type can be left, center, justify, or right.
Example:
{| class="wikitable" style="text-align:center" align="right" |+ '''Cells centered, table right''' ! Lorem || ipsum || dolor |- | sit || amet, consectetur || adipisicing elit, |- | sed do eiusmod || tempor incididunt ut labore || et dolore magna aliqua. |} {| class="wikitable" style="text-align:right" align="left" |+ '''Cells right-aligned, table left''' ! Ut || enim || ad |- | minim || veniam, quis || nostrud exercitation ullamco |- | laboris nisi ut || aliquip ex ea || commodo consequat. |} {{Lorem ipsum}}
Yields:
Lorem | ipsum | dolor |
---|---|---|
sit | amet, consectetur | adipisicing elit, |
sed do eiusmod | tempor incididunt ut labore | et dolore magna aliqua. |
Ut | enim | ad |
---|---|---|
minim | veniam, quis | nostrud exercitation ullamco |
laboris nisi ut | aliquip ex ea | commodo consequat. |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Centering tables
Centered tables can be achieved, but they will not "float"; that is to say, no text will appear to either side. The trick is {| style="margin: 1em auto 1em auto"
{| class="wikitable" style="margin: 1em auto 1em auto" |+ '''Cells left-aligned, table centered''' ! Duis || aute || irure |- | dolor || in reprehenderit || in voluptate velit |- | esse cillum dolore || eu fugiat nulla || pariatur. |} ''{{Lorem ipsum}}''
Yields:
Duis | aute | irure |
---|---|---|
dolor | in reprehenderit | in voluptate velit |
esse cillum dolore | eu fugiat nulla | pariatur. |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Other table syntax
Other types of table syntax that MediaWiki supports:
- XHTML
- HTML and wiki <td> syntax
All three are supported by MediaWiki and create (currently) valid HTML output, but the pipe syntax is the simplest, except perhaps for people who are already familiar with HTML. Also, HTML and wiki <td> syntax will not necessarily remain browser-supported in the upcoming future, especially on handheld internet-accessible devices.
See also HTML element#Tables. Note however that the thead
, tbody
, tfoot
, colgroup
, and col
elements are currently not supported in MediaWiki.
Comparison
XHTML | HTML & Wiki-td | Wiki-pipe | |||||||
---|---|---|---|---|---|---|---|---|---|
Table | <table></table> | <table></table> | {| params |} | ||||||
Caption | <caption></caption> | <caption></caption> | |+ caption | ||||||
Row | <tr></tr> | <tr> | |- params | ||||||
Data cell |
<td>cell1</td> |
<td>cell1 |
| cell1 | cell2 | ||||||
Data cell | <td>cell1</td> <td>cell2</td> <td>cell3</td> | <td>cell1 <td>cell2 <td>cell3 | |cell1||cell2||cell3 | ||||||
Header cell | <th></th> | <th> | ! heading | ||||||
Sample table |
| ||||||||
<table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> </table> | <table> <tr> <td> 1 <td> 2 <tr> <td> 3 <td> 4 </table> | {| | 1 || 2 |- | 3 || 4 |} | |||||||
Sample table |
| ||||||||
<table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> </tr> </table> | <table> <tr> <td> 1 <td> 2 <tr> <td> 3 <td> 4 <tr> <td> 5 <td> 6 </table> | {| | 1 || 2 |- | 3 || 4 |- | 5 || 6 |} | |||||||
Pros |
|
|
| ||||||
Cons |
|
|
| ||||||
XHTML | HTML & Wiki-td | Wiki-pipe |
Pipe syntax in terms of the HTML produced
The pipe syntax, developed by Magnus Manske, substitutes pipes (|) for HTML. There is an on-line script which converts html tables to pipe syntax tables.
The pipes must start at the beginning of a new line, except when separating parameters from content or when using ||
to separate cells on a single line. The parameters are optional.
Tables
A table is defined by {| ''params'' |} which equals <table ''params''>Insert non-formatted text here </table>
- Careful: You must include the space between
{|
andparams
, or the first parameter gets ignored.
Rows
<tr> tags will be generated automatically for the first row. To start a new row, use
|-
which results in
<tr>
Parameters can be added like this:
|- params
which results in
<tr params>
Note:
- <tr> tags will be automatically opened at the first <td> equivalent
- <tr> tags will be automatically closed at <tr> and </table> equivalents
Cells
Cells are generated either like this:
|cell1 |cell2 |cell3
or like this:
|cell1||cell2||cell3
which both equal
<td>cell1</td><td>cell2</td><td>cell3</td>
so "||" equals "newline" + "|"
Parameters in cells can be used like this:
|params|cell1||params|cell2||params|cell3
which will result in
<td params>cell1</td> <td params>cell2</td> <td params>cell3</td>
Headers
Functions the same way as TD, except "!" is used instead of the opening "|". "!!" can be used instead of "||". Parameters still use "|", though! Example:
!params|cell1
Captions
A <caption> tag is created by
|+ Caption
which generates
<caption>Caption</caption>
You can also use parameters:
|+ params|Caption
which will generate
<caption params>Caption</caption>
Text next to a table
(To see the effects, you may have to increase or decrease the fontsize setting of your browser, or vary the width of your browser window.)
Right table
Use align="right", and enter the text after the table code. This paragraph is before the table. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
× | 1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
4 | 4 | 8 | 12 |
5 | 5 | 10 | 15 |
This paragraph is after the table. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis tellus. Donec ante dolor, iaculis nec, gravida ac, cursus in, eros. Mauris vestibulum, felis et egestas ullamcorper, purus nibh vehicula sem, eu egestas ante nisl non justo. Fusce tincidunt, lorem nec dapibus consectetuer, leo orci mollis ipsum, eget suscipit eros purus in ante. At ipsum vitae est lacinia tincidunt. Maecenas elit orci, gravida ut, molestie non, venenatis vel, lorem. Sed lacinia. Suspendisse potenti. Sed ultricies cursus lectus. In id magna sit amet nibh suscipit euismod. Integer enim. Donec sapien ante, accumsan ut, sodales commodo, auctor quis, lacus. Maecenas a elit lacinia urna posuere sodales. Curabitur pede pede, molestie id, blandit vitae, varius ac, purus. Mauris at ipsum vitae est lacinia tincidunt. Maecenas elit orci, gravida ut, molestie non, venenatis vel, lorem. Sed lacinia. Suspendisse potenti. Sed ultricies cursus lectus. In id magna sit amet nibh suscipit euismod. Integer enim. Donec sapien ante, accumsan ut, sodales commodo, auctor quis, lacus. Maecenas a elit lacinia urna posuere sodales. Curabitur pede pede, molestie id, blandit vitae, varius ac, purus.
However, do not put preformatted text there, it may overlap the table because it does not wrap:
× | 1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
4 | 4 | 8 | 12 |
5 | 5 | 10 | 15 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis tellus. Donec ante dolor, iaculis nec, gravida ac, cursus in, eros. Mauris vestibulum, felis et egestas ullamcorper, purus nibh vehicula sem, eu egestas ante nisl non justo.
Fusce tincidunt, lorem nec dapibus consectetuer, leo orci mollis ipsum, eget suscipit eros purus in ante. At ipsum vitae est lacinia tincidunt. Maecenas elit orci, gravida ut, molestie non, venenatis vel, lorem. Sed lacinia. Suspendisse potenti. Sed ultricies cursus lectus.
In id magna sit amet nibh suscipit euismod. Integer enim. Donec sapien ante, accumsan ut, sodales commodo, auctor quis, lacus. Maecenas a elit lacinia urna posuere sodales. Curabitur pede pede, molestie id, blandit vitae, varius ac, purus. Mauris at ipsum vitae est lacinia tincidunt.
To prevent this, see below.
Left table
Use align="left", and enter the text after the table code. This paragraph is before the table. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
× | 1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
4 | 4 | 8 | 12 |
5 | 5 | 10 | 15 |
This paragraph is after the table. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis tellus. Donec ante dolor, iaculis nec, gravida ac, cursus in, eros. Mauris vestibulum, felis et egestas ullamcorper, purus nibh vehicula sem, eu egestas ante nisl non justo. Fusce tincidunt, lorem nec dapibus consectetuer, leo orci mollis ipsum, eget suscipit eros purus in ante. At ipsum vitae est lacinia tincidunt. Maecenas elit orci, gravida ut, molestie non, venenatis vel, lorem. Sed lacinia. Suspendisse potenti. Sed ultricies cursus lectus. In id magna sit amet nibh suscipit euismod. Integer enim. Donec sapien ante, accumsan ut, sodales commodo, auctor quis, lacus. Maecenas a elit lacinia urna posuere sodales. Curabitur pede pede, molestie id, blandit vitae, varius ac, purus. Mauris at ipsum vitae est lacinia tincidunt. Maecenas elit orci, gravida ut, molestie non, venenatis vel, lorem. Sed lacinia. Suspendisse potenti. Sed ultricies cursus lectus. In id magna sit amet nibh suscipit euismod. Integer enim. Donec sapien ante, accumsan ut, sodales commodo, auctor quis, lacus. Maecenas a elit lacinia urna posuere sodales. Curabitur pede pede, molestie id, blandit vitae, varius ac, purus.
Starting text after tables
To start text after a table, use {{clear}}
, {{-}}
, or <br style="clear:both;">
. These all do the same thing.
This is particularly important in the case of preformatted text (see example above), and sometimes desired in the case that a new section starts.
Setting parameters
At the start of a cell, add your parameter followed by a single pipe. For example width=300px| will set that cell to a width of 300 pixels. To set more than one parameter, leave a space between each one.
Wiki markup
{| |- | bgcolor=red|cell1 || width=300px bgcolor=blue|cell2 || bgcolor=green|cell3 |}
What it looks like in your browser
cell1 cell2 cell3
Decimal point alignment
A method to get columns of numbers aligned at the decimal point is as follows:
<blockquote> {| cellpadding=0 cellspacing=0 |align=right| 432 || .1 |- |align=right| 43 || .21 |- |align=right| 4 || .321 |} </blockquote>
gives
432 .1 43 .21 4 .321
If the column of numbers appears in a table with cell padding or cell spacing, one can still align the decimal points without an unsightly gap in the middle. Embed a table in each number's cell and specify its column widths. Make the embedded tables' column widths the same for each cell in the column. (If decimal points are still misaligned using this method, the main table's column may be too narrow. Add a parameter to increase the column's width.)
<blockquote> {|border = 1 cellpadding=4 cellspacing=2 width=72 | {|cellpadding=0 cellspacing=0 width="100%" |align=right width="50%"| 432 ||width="50%"| .1 |} |- | {|cellpadding=0 cellspacing=0 width="100%" |align=right width="50%"| 43 ||width="50%"| .21 |} |- | {|cellpadding=0 cellspacing=0 width="100%" |align=right width="50%"| 4 ||width="50%"| .321 |} |} </blockquote>
gives
432 .1
43 .21
4 .321
In simple cases one can dispense with the table feature and simply start the lines with a space, and put spaces to position the numbers:
432.1 43.21 4.321
Style classes
Some users have created CSS classes to make table styles easier. Instead of remembering table parameters, you just include an appropriate style class after the {|
. This helps keep table formatting consistent, and can allow a single change to the class to fix a problem or enhance the look of all tables that use it. For instance, this:
× | 1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
4 | 4 | 8 | 12 |
5 | 5 | 10 | 15 |
becomes this:
× | 1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
4 | 4 | 8 | 12 |
5 | 5 | 10 | 15 |
simply by replacing the border="1" cellpadding="2"
section with class="wikitable"
, because (on this wiki) the wikitable class in MediaWiki:Common.css contains the following style rules:
/* wikitable/prettytable class for skinning normal tables */
table.wikitable,
table.prettytable {
margin: 1em 1em 1em 0;
background: #f9f9f9;
border: 1px #aaaaaa solid;
border-collapse: collapse;
}
table.wikitable th, table.wikitable td,
table.prettytable th, table.prettytable td {
border: 1px #aaaaaa solid;
padding: 0.2em;
}
table.wikitable th,
table.prettytable th {
background: #f2f2f2;
text-align: center;
}
table.wikitable caption,
table.prettytable caption {
margin-left: inherit;
margin-right: inherit;
}
Gallery
As a by-product of the image gallery feature, a table can be made with the gallery tag; if a text entry contains a link, the whole entry is ignored.
<gallery> Drenthe Flevoland Friesland Gelderland Groningen Limburg North Brabant (capital: [[Den Bosch]]) North Holland Overijssel South Holland Utrecht Zeeland </gallery>
gives:
See also
External links
- VBA-Macro for EXCEL tableconversion published in German-Wikipediaproject (english instructions included)
- HTML tables to wiki converter at cnic.org
- csv2wp - converts comma-separated values (CSV) format to pipe syntax. You may use this to import tables from Excel etc. (more information)
- HTML tables to wiki converter at wackyboy.com
- HTML tables to wiki converter at uni-bonn.de
- HTML tables to wiki converter at diberri.dyndns.org
- pywikipediabot (can convert HTML tables to wiki)
Links to other help pages
- Help contents
- Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
- Versions of this help page (for other languages see further)
- What links here on Meta or from Meta · Wikipedia · MediaWiki
- Reading
- Go · Search · Namespace · Page naming · Section · Backlinks · Redirect · Category · Image page · Special pages · Printing
- Tracking changes
- Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
- Logging in and preferences
- Logging in · Preferences
- Editing
- Starting a new page · Advanced editing · Editing FAQ · Export · Import · Shortcuts · Edit conflict · Page size
- Referencing
- Links · URL · · Footnotes
- Style and formatting
- Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · Lists · Table · Sorting · Colors · Images and file uploads
- Fixing mistakes
- Show preview · Reverting edits
- Advanced functioning
- Expansion · Template · Advanced templates · Parser function · Magic words · System message · Substitution · Arrays · Expr parser function syntax · Transclusion
- Others
- Special characters · Renaming (moving) a page · Preparing a page for translation · Talk pages · Signatures · Sandbox · Legal issues for editors