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!
=== Optional parameters === {{anchor|wikitable class}} Optional '''parameters''' can modify the display and styling of cells, rows, or the entire table. The simplest way to add styling is to set the <code>wikitable</code> [[CSS]] class, which in Wikipedia's [[MediaWiki:Common.css|external style sheet]] is defined to apply a gray color scheme and cell borders to tables using it: <div class="box"> '''Wikitext''' <syntaxhighlight lang="wikitext" highlight=1> {| class=wikitable |+ The table's caption ! Column header 1 ! Column header 2 ! Column header 3 |- ! Row header 1 | Cell 2 || Cell 3 |- ! Row header A | Cell B | Cell C |} </syntaxhighlight></div> <div class="box"> '''Produces''' {| class=wikitable |+ The table's caption ! Column header 1 ! Column header 2 ! Column header 3 |- ! Row header 1 | Cell 2 || Cell 3 |- ! Row header A | Cell B | Cell C |} </div> The table parameters and cell parameters are the same as in [[HTML]], see http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE and [[Table (HTML)]]. However, the {{tag|thead|o}}, {{tag|tbody|o}}, {{tag|tfoot|o}}, {{tag|colgroup|o}}, and {{tag|col|o}} elements are currently [[Help:HTML in wikitext#thead, tfoot, tbody|not supported in MediaWiki]], {{as of|lc=y|2021|12}}. 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 [[meta:Template talk:Square 8x8 pentomino example]]. An "image" in the form of a table is much more convenient to edit than an uploaded image. If all the cells in a row are empty the cells still show up. If the header cell is also empty for that row all the cells show up, but they are narrow. That can be fixed with a simple <nowiki><br></nowiki> in one of the cells. That is what is done here: * {{oldid2|1206274265|Sorting buttons in a separate row|2024 revision of {{delink|{{slink|Help:Sortable tables#Sorting buttons in a separate row}}}}}} {{t|sort under}} is simpler for putting the sorting arrows below the header text in order to narrow a table. With <code>colspan</code> and <code>rowspan</code> cells can span several columns or rows; {{see below|{{section link||Colspan and rowspan}}, below}}
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)