Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Table
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Table basics == Tables can be added to articles and other pages using either standard [[HTML element#Tables|HTML table elements]], or with special [[wikicode]] markup developed just to facilitate creating tables without a knowledge of HTML. === Markup === {{See also|Help:Basic table markup}} {{mw-datatable}} {| class="wikitable mw-datatable" |+Overview of basic table markup |- ! scope="col" | Table element ! scope="col" | Wikitext ! scope="col" | Required ! scope="col" | Usage notes |- ! scope="row" | Table start | {{kbd|<nowiki>{|</nowiki>}} | '''Required''' | Note: {{kbd|<nowiki>{|</nowiki>}} Entire table goes here {{kbd|<nowiki>|}</nowiki>}} |- ! scope="row" | Caption | {{kbd|<nowiki>|+</nowiki>}} | Optional | Only between table start and first table row. |- ! scope="row" | Row | {{kbd|<nowiki>|-</nowiki>}} | Optional | Can be omitted before the first row. |- ! scope="row" | Header cell | {{kbd|<nowiki>!</nowiki>}} or {{kbd|<nowiki>!!</nowiki>}} | Optional | Consecutive table header cells may be added on the same line separated by double marks (<code>!!</code>); or start on new lines, each with its own single mark (<code>!</code>). |- ! scope="row" | Data cell | {{nowrap|{{kbd|<nowiki>|</nowiki>}} or {{kbd|<nowiki>||</nowiki>}}}} | Optional | Consecutive table data cells may be added on the same line separated by double marks (<code><nowiki>||</nowiki></code>) or start on new lines, each with its own single mark (<code><nowiki>|</nowiki></code>). This mark is also used to separate [[HTML attribute]]s from cell and caption contents. |- ! scope="row" | Table end | {{kbd|<nowiki>|}</nowiki>}} | '''Required''' | |} *The above marks must ''start on a new line'', except the double marks (<code>||</code> and <code>!!</code>) for optionally adding consecutive cells to a single line. *''Blank spaces'' at the beginning of a line are ignored. *''Content'' may either follow its cell mark on the same line (after any optional HTML attributes); or on lines below the cell mark (beware of undesired paragraphs though). Content that uses wiki markup that itself needs to start on a new line, such as with lists, headings, or nested tables, must be on its own new line. *To insert a ''pipe character'' (<code>|</code>) into a table caption or cell, use the <code><nowiki>|</nowiki></code> escaping markup. ===HTML attributes=== Each mark, except table end (<code><nowiki>|}</nowiki></code>), optionally accepts one or more ''[[HTML attribute|attributes]]''. Attributes must be on the same line as the mark. *''Cells'' and ''captions'' (<code>|</code> or <code>||</code>, <code>!</code> or <code>!!</code>, and <code>|+</code>) hold ''content''—separate any attribute from its content with a single pipe (<code>|</code>), with attributes preceding content. *''Table'' and ''row'' marks (<code><nowiki>{|</nowiki></code> and <code>|-</code>) do not directly hold content. Do ''not'' add a pipe (<code><nowiki>|</nowiki></code>) after any attributes. Commonly included attributes with table scope include: <code>class</code>, for example <code>class="wikitable"</code>; or <code>style</code> for [[CSS]] styling. Other attributes have row- or column scope, e.g., <code>scope</code>, to indicate row or column header cells; <code>rowspan</code>, to extend cells by more than one row; and <code>colspan</code>, to extend cells by more than one column.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)