Tables
The pipe syntax
{|
|+ An optional caption
! Header !! Another header
|-
| a cell || another cell
|-
| style="text-align:right" | attributes, then content
|}| Marker | Meaning |
|---|---|
{| | open the table — the rest of the line is table attributes |
|+ | caption |
|- | start a row — rest of line is row attributes |
! | header cell (!! separates several on one line) |
| | data cell (|| separates several on one line) |
|} | close the table |
Cell attributes: put them before a single |, as in the example above. The
parser is careful about wikilinks — a cell that begins with a [[…|…]] link
is treated as content, not attributes.
Tables nest: open another {| on its own line inside a cell. Prefixing the
{| line with : characters indents the whole table.
Every table inside an article is styled as a data table automatically — borders, padding, bold headers, no class needed.
Different from MediaWiki: you don’t need class="wikitable" to get a
styled table. It’s accepted (Wikipedia habits die hard) but adds nothing by
itself — the classes that actually do something are the helpers below.
Responsive helpers
Add these classes on the {| line (they combine):
| Class | Effect |
|---|---|
wikitable-scroll | the table scrolls horizontally instead of stretching the page |
wikitable-pinfirst | pins the first column while the rest scrolls |
wikitable-responsive | full-width on phones |
wikitable-card | on phones, each row becomes a card with the column headers as field labels |
wikitable-stack | on phones, cells stack vertically |
wikitable-shrink | on phones, compact font and padding |
wikitable-card is the smart one: the parser records your ! header texts
and stamps each cell with its column label, so the phone view can print
“Header: value” pairs. The others are pure CSS.
Spanning cells, attributes on rows/cells/captions, nesting, and the card mechanism in detail: Advanced table markup.