Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Numinix MediaWiki Demo
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Help/Tables
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
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!
==Basics== <!--T:31--> === Create a table with editor toolbar === <!--T:449--> </translate> <translate><!--T:450--> In wikitext editor, place the caret where you want to insert a table.</translate> <translate><!--T:462--> Then, in the toolbar, press <tvar name=1><code></code></tvar>, then choose <tvar name=2><span style="white-space: nowrap;">[[File:OOjs UI icon table.svg|class=skin-invert-image]] </span></tvar> button.</translate> <translate><!--T:451--> A dialog opens.</translate> <translate><!--T:452--> From the dialog, you can choose whether to enable a table header row, to stylize the table with border and to make the table [[<tvar name=1>Special:MyLanguage/Help:Sortable tables</tvar>|sortable]].</translate> <translate><!--T:453--> A preview example is displayed.</translate> <translate><!--T:454--> You can also set row and column counts you need. Then, press <tvar name=1><code></code></tvar> button.</translate> <translate> <!--T:455--> By default, the following code is generated: </translate> <div style="display:flex"> <div style="width:45%; border:1px solid black; padding:0.5em"> <h5 style="text-align:center"><translate><!--T:456--> Wikicode:</translate></h5> {<nowiki/>| class="wikitable" style="margin:auto" |+ |- ! !! !! |- | || || |- | || || |- | || || |} </div> <div style="width:45%; border:1px solid black; padding:0.5em; margin-left:2ex"> <h5 style="text-align:center; margin-bottom:1em"><translate><!--T:457--> Result:</translate></h5> {| class="wikitable" style="margin:auto" |+ |- ! !! !! |- | || || |- | || || |- | || || |} </div> </div> <translate> === Minimal syntax === <!--T:458--> <!--T:32--> The following table lacks borders and good spacing but shows the simplest wiki markup table structure. </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:404--> You type</translate> !style="width:50%"| <translate><!--T:405--> You get</translate> |- |style="padding:5px"| <pre> {| | <translate nowrap><!--T:33--> Orange</translate> | <translate nowrap><!--T:34--> Apple</translate> |- | <translate nowrap><!--T:35--> Bread</translate> | <translate nowrap><!--T:36--> Pie</translate> |- | <translate nowrap><!--T:37--> Butter</translate> | <translate nowrap><!--T:38--> Ice cream</translate> |} </pre> |style="padding:5px"| {| | <translate><!--T:39--> Orange</translate> | <translate><!--T:40--> Apple</translate> |- | <translate><!--T:41--> Bread</translate> | <translate><!--T:42--> Pie</translate> |- | <translate><!--T:43--> Butter</translate> | <translate><!--T:44--> Ice cream</translate> |} |} <translate><!--T:45--> The cells in the same row can be listed on one line separated by <code>||</code> (two pipe symbols).</translate> <translate><!--T:46--> If the text in the cell should contain a line break, use <tvar name=br></tvar> instead.</translate> {| style="width:100%" !style="width:50%"| <translate><!--T:406--> You type</translate> !style="width:50%"| <translate><!--T:407--> You get</translate> |- |style="padding:5px"| <pre> {| | <translate nowrap><!--T:47--> Orange</translate> || <translate nowrap><!--T:392--> Apple</translate> || <translate nowrap><!--T:393--> more</translate> |- | <translate nowrap><!--T:48--> Bread</translate> || <translate nowrap><!--T:394--> Pie</translate> || <translate nowrap><!--T:395--> more</translate> |- | <translate nowrap><!--T:49--> Butter</translate> || <translate nowrap><!--T:396--> Ice<br/>cream</translate> || <translate nowrap><!--T:403--> and<br/>more</translate> |} </pre> |style="padding:5px"| {| | <translate><!--T:50--> Orange</translate> || <translate><!--T:397--> Apple</translate> || <translate><!--T:398--> more</translate> |- | <translate><!--T:51--> Bread</translate> || <translate><!--T:399--> Pie</translate> || <translate><!--T:400--> more</translate> |- | <translate><!--T:52--> Butter</translate> || <translate><!--T:401--> Ice<br/>cream</translate> || <translate><!--T:402--> and<br/>more</translate> |} |} <translate> <!--T:53--> Extra spaces within cells in the wiki markup, as in the wiki markup below, do not affect the actual table rendering. </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:408--> You type</translate> !style="width:50%"| <translate><!--T:409--> You get</translate> |- | style="padding: 5px;"| <pre> {| | <translate nowrap><!--T:54--> Orange</translate> || <translate nowrap><!--T:380--> Apple</translate> || <translate nowrap><!--T:381--> more</translate> |- | <translate nowrap><!--T:55--> Bread</translate> || <translate nowrap><!--T:382--> Pie</translate> || <translate nowrap><!--T:383--> more</translate> |- | <translate nowrap><!--T:56--> Butter</translate> || <translate nowrap><!--T:384--> Ice cream</translate> || <translate nowrap><!--T:385--> and more</translate> |} </pre> | style="padding: 5px;"| {| | <translate><!--T:57--> Orange</translate> || <translate><!--T:386--> Apple</translate> || <translate><!--T:387--> more</translate> |- | <translate><!--T:58--> Bread</translate> || <translate><!--T:388--> Pie</translate> || <translate><!--T:389--> more</translate> |- | <translate><!--T:59--> Butter</translate> || <translate><!--T:390--> Ice cream</translate> || <translate><!--T:391--> and more</translate> |} |} <translate> <!--T:60--> You can have longer text or more complex wiki syntax inside table cells, too: </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:410--> You type</translate> !style="width:50%"| <translate><!--T:411--> You get</translate> |- | style="padding: 5px;"| <pre> {| |Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | * Lorem ipsum dolor sit amet * consetetur sadipscing elitr * sed diam nonumy eirmod tempor invidunt |} </pre> | style="padding: 5px;"| {| |Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | * Lorem ipsum dolor sit amet * consetetur sadipscing elitr * sed diam nonumy eirmod tempor invidunt |} |} <translate> === Table headers === <!--T:61--> </translate> <translate><!--T:62--> Table headers can be created by using "<tvar name="1"><code>!</code></tvar>" (exclamation mark) instead of "<tvar name="2"><code>|</code></tvar>" (pipe symbol).</translate> <translate><!--T:63--> Headers usually show up bold and centered by default.</translate> {| style="width:100%" !style="width:50%"| <translate><!--T:64--> You type</translate> !style="width:50%"| <translate><!--T:65--> You get</translate> |- | style="padding: 5px;"| <pre> {| !style="text-align:left"| <translate nowrap><!--T:66--> Item</translate> ! <translate nowrap><!--T:67--> Amount</translate> ! <translate nowrap><!--T:68--> Cost</translate> |- | <translate nowrap><!--T:69--> Orange</translate> |10 |7.00 |- | <translate nowrap><!--T:70--> Bread</translate> |4 |3.00 |- | <translate nowrap><!--T:71--> Butter</translate> |1 |5.00 |- ! <translate nowrap><!--T:72--> Total</translate> | |15.00 |} </pre> | style="padding: 5px;"| {| ! style="text-align:left;"| <translate><!--T:73--> Item</translate> ! <translate><!--T:74--> Amount</translate> ! <translate><!--T:75--> Cost</translate> |- | <translate><!--T:76--> Orange</translate> |10 |7.00 |- | <translate><!--T:77--> Bread</translate> |4 |3.00 |- | <translate><!--T:78--> Butter</translate> |1 |5.00 |- ! <translate><!--T:79--> Total</translate> | |15.00 |} |} {{note|1=<translate><!--T:80--> When using attributes as in the heading 'Item' a vertical bar '<tvar name=1><nowiki>|</nowiki></tvar>' is used for separation.</translate> <translate><!--T:81--> Not an exclamation character '!'.</translate>}} <translate> ===Caption=== <!--T:82--> <!--T:83--> A '''table caption''' can be added to the top of any table as follows. </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:84--> You type</translate> !style="width:50%"| <translate><!--T:85--> You get</translate> |- | style="padding: 5px;"| <pre> {| |+<translate nowrap><!--T:86--> Food complements</translate> |- | <translate nowrap><!--T:87--> Orange</translate> | <translate nowrap><!--T:88--> Apple</translate> |- | <translate nowrap><!--T:89--> Bread</translate> | <translate nowrap><!--T:90--> Pie</translate> |- | <translate nowrap><!--T:91--> Butter</translate> | <translate nowrap><!--T:92--> Ice cream</translate> |} </pre> | style="padding: 5px;"| {| |+ <translate><!--T:93--> Food complements</translate> |- | <translate><!--T:94--> Orange</translate> | <translate><!--T:95--> Apple</translate> |- | <translate><!--T:96--> Bread</translate> | <translate><!--T:97--> Pie</translate> |- | <translate><!--T:98--> Butter</translate> | <translate><!--T:99--> Ice cream</translate> |} |} === class="wikitable" === <translate> <!--T:101--> Basic styling (light gray background, borders, padding and align left) can be achieved by adding class="wikitable". </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:102--> You type</translate> !style="width:50%"| <translate><!--T:103--> You get</translate> |- | style="padding: 5px;"| <pre> {| class="wikitable" |+<translate nowrap><!--T:104--> Food complements</translate> |- | <translate nowrap><!--T:105--> Orange</translate> | <translate nowrap><!--T:106--> Apple</translate> |- | <translate nowrap><!--T:107--> Bread</translate> | <translate nowrap><!--T:108--> Pie</translate> |- | <translate nowrap><!--T:109--> Butter</translate> | <translate nowrap><!--T:110--> Ice cream</translate> |} </pre> | style="padding: 5px;"| {| class="wikitable" |+ <translate><!--T:111--> Food complements</translate> |- | <translate><!--T:112--> Orange</translate> | <translate><!--T:113--> Apple</translate> |- | <translate><!--T:114--> Bread</translate> | <translate><!--T:115--> Pie</translate> |- | <translate><!--T:116--> Butter</translate> | <translate><!--T:117--> Ice cream</translate> |} |} <translate> ===HTML colspan and rowspan=== <!--T:118--> <!--T:119--> You can use HTML '''colspan''' and '''rowspan''' attributes on cells for advanced layout. </translate> {| style="width:100%" !style="width:50%"| <translate><!--T:412--> You type</translate> !style="width:50%"| <translate><!--T:413--> You get</translate> |- | style="padding: 5px;"| <pre> {| class="wikitable" !colspan="6"| <translate nowrap><!--T:120--> Shopping List</translate> |- |rowspan="2"| <translate nowrap><!--T:121--> Bread & Butter</translate> | <translate nowrap><!--T:122--> Pie</translate> | <translate nowrap><!--T:123--> Buns</translate> | <translate nowrap><!--T:124--> Danish</translate> |colspan="2"| <translate nowrap><!--T:125--> Croissant</translate> |- | <translate nowrap><!--T:126--> Cheese</translate> |colspan="2"| <translate nowrap><!--T:127--> Ice cream</translate> | <translate nowrap><!--T:128--> Butter</translate> | <translate nowrap><!--T:129--> Yogurt</translate> |} </pre> | style="padding: 5px;"| {| class="wikitable" !colspan="6"| <translate><!--T:130--> Shopping List</translate> |- |rowspan="2"| <translate><!--T:131--> Bread & Butter</translate> | <translate><!--T:132--> Pie</translate> | <translate><!--T:133--> Buns</translate> | <translate><!--T:134--> Danish</translate> |colspan="2"| <translate><!--T:135--> Croissant</translate> |- | <translate><!--T:136--> Cheese</translate> |colspan="2"| <translate><!--T:137--> Ice cream</translate> | <translate><!--T:138--> Butter</translate> | <translate><!--T:139--> Yogurt</translate> |} |} <translate> === Note about large tables (noresize class) === <!--T:463--> </translate> <translate><!--T:464--> The use of the wrapping <tvar name=1><code>div.noresize</code></tvar> will ensure your table is optimized for mobile and is extremely important for large tables e.g. tables with more than 4 columns or large columns.</translate> <translate><!--T:465--> Failure to use this element will cause your content to overlap UI elements e.g. the Vector 2022 sidebar or to break mobile display.</translate> <translate><!--T:466--> This will cause the table to have a horizontal scroll bar when the table is too big for the content.</translate> <translate> <!--T:467--> You type: </translate> <pre> <div class="noresize"> {| class="wikitable" ! colspan="6" |Shopping List |- | rowspan="2" |Areallyreallyreallyreallylongstringwillcauseyourtableto | Pie | Buns | Danish | colspan="2" |Croissantsmaycausetexttoincreasethesizeofyourcolumnsoitbreaksoutofthecontent area if you do not wrap the table with noresize. |- | Cheese | colspan="2" |Ice cream | Butter | Yogurt |} </div> </pre> <translate> <!--T:468--> You get:</translate> <div class="noresize"> {| class="wikitable" ! colspan="6" |Shopping List |- | rowspan="2" |Areallyreallyreallyreallylongstringwillcauseyourtableto | Pie | Buns | Danish | colspan="2" |Croissantsmaycausetexttoincreasethesizeofyourcolumnsoitbreaksoutofthecontent area if you do not wrap the table with noresize. |- | Cheese | colspan="2" |Ice cream | Butter | Yogurt |} </div> <translate>
Summary:
Please note that all contributions to Numinix MediaWiki Demo may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)