Help:Tables: Difference between revisions

Created page with "Basic tables can be generated in the visual editor under the "insert" dropdown, or under the "advanced" toolbar in the source editor. This will allow you to create a table with a specified number of rows and columns and apply a few other settings. However, there are more advanced options for tables that are only possible in the source editor. ==Syntax== These markers must be the first characters on each line of wikitext for them to count. *<code>{|</code> marks the star..."
 
 
(One intermediate revision by the same user not shown)
Line 162: Line 162:
|Cell 5
|Cell 5
|style="text-align:center"|Cell 6
|style="text-align:center"|Cell 6
|}
|}
===Centering columns===
If you want to center all cells in a specific column, it can be a bit of a pain to add <code>style="text-align:center"</code> to every cell in that column, so this wiki has special CSS classes that you can add to the table classes to center all cells in a specific column automatically. Use <code>center-col-X</code> and replace X with a number for the column.
{|class="wikitable"
!Wikitext
!Result
|-
|<pre>{|class="wikitable center-col-2"
!Header 1 !! Header 2 !! Header 3
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell 4 || Cell 5 || Cell 6
|-
|Cell 7 || Cell 8 || Cell 9
|}</pre>
|
{|class="wikitable center-col-2"
!Header 1 !! Header 2 !! Header 3
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell 4 || Cell 5 || Cell 6
|-
|Cell 7 || Cell 8 || Cell 9
|}
|}
|}
|}