Help:Table: Difference between revisions
Jump to navigation
Jump to search
extracted from SandBox |
extracted from basic examples on Help:Editing # Tables |
||
| Line 1: | Line 1: | ||
todo | todo | ||
:'' | :''For basic usage see [[Help:Editing #Tables]]'' | ||
== Some Examples == | == Some Examples == | ||
| Line 117: | Line 117: | ||
|- | |- | ||
| 6 || 200 ||Debussy loves it. | | 6 || 200 ||Debussy loves it. | ||
|} | |||
== Special needs == | |||
=== Adjusting Text Alignment === | |||
The table cells are left aligned by default, the heading cells are center aligned. You may change this via inline CSS style definitions: | |||
{| class="wikitable" | |||
! what you want for the cell | |||
! what you do to get it | |||
|- | |||
| left aligned text | |||
| nothing to do | |||
|- | |||
| style="text-align:center;" | centered text | |||
| place <code><nowiki>style="text-align:center;" |</nowiki></code> after the opening pipe | |||
|- | |||
| style="text-align:right;" | right aligned | |||
| place <code><nowiki>style="text-align:center;" |</nowiki></code> after the opening pipe | |||
|- | |||
! headline style | |||
| exclamation mark instead of the pipe symbol starts the cell | |||
|} | |||
If you want to override the default text alignment for all cells, place the inline CSS (for example <code>style="text-align:center;"</code>) directly at the beginning of the table, right after the <code>class="wikitable"</code> statement. | |||
=== External helper tools === | |||
If you have to construct really complex tables with colspans and rowspans, you may use this online table generator: | |||
[http://www.tablesgenerator.com/mediawiki_tables Generate tables in MediaWiki format - TablesGenerator.com] | |||
For example, this wiki markup | |||
<nowiki> | |||
{| class="wikitable" | |||
! colspan="3" | 1 | |||
! 2 | |||
! 3 | |||
|- | |||
| rowspan="2" | A | |||
| colspan="3" | B | |||
| C | |||
|- | |||
| rowspan="2" colspan="2" | D | |||
| colspan="2" | E | |||
|- | |||
| F | |||
| G | |||
| H | |||
|}</nowiki> | |||
will be rendered into this table: | |||
{| class="wikitable" | |||
! colspan="3" | 1 | |||
! 2 | |||
! 3 | |||
|- | |||
| rowspan="2" | A | |||
| colspan="3" | B | |||
| C | |||
|- | |||
| rowspan="2" colspan="2" | D | |||
| colspan="2" | E | |||
|- | |||
| F | |||
| G | |||
| H | |||
|} | |} | ||
Revision as of 20:00, 22 October 2018
todo
- For basic usage see Help:Editing #Tables
Some Examples
table layout without border lines
{|
|-
! A
! B
|-
| 1
| 2
|-
| x
| xx
|}
| A | B |
|---|---|
| 1 | 2 |
| x | xx |
standard wiki table layout
{| class="wikitable"
|-
! A
! B
|-
| 1
| 2
|-
| x
| xx
|}
| A | B |
|---|---|
| 1 | 2 |
| x | xx |
heading style for left and top cells
{| class="wikitable"
|-
! ??
! 1
! 2
|-
! A
| a1
| a2
|-
! B
| b1
| b2
|}
| ?? | 1 | 2 |
|---|---|---|
| A | a1 | a2 |
| B | b1 | b2 |
sortable tables
{| class="wikitable sortable"
|-
! Steps per Octave !! Step Size
! class="unsortable" | comments
|-
| 15 || 80 || This is nice
|-
| 24 || 50 || Peppermint
|-
| 12 || 100 || Try this for free
|-
| 6 || 200 ||Debussy loves it.
|}
| Steps per Octave | Step Size | comments |
|---|---|---|
| 15 | 80 | This is nice |
| 24 | 50 | Peppermint |
| 12 | 100 | Try this for free |
| 6 | 200 | Debussy loves it. |
Special needs
Adjusting Text Alignment
The table cells are left aligned by default, the heading cells are center aligned. You may change this via inline CSS style definitions:
| what you want for the cell | what you do to get it |
|---|---|
| left aligned text | nothing to do |
| centered text | place style="text-align:center;" | after the opening pipe
|
| right aligned | place style="text-align:center;" | after the opening pipe
|
| headline style | exclamation mark instead of the pipe symbol starts the cell |
If you want to override the default text alignment for all cells, place the inline CSS (for example style="text-align:center;") directly at the beginning of the table, right after the class="wikitable" statement.
External helper tools
If you have to construct really complex tables with colspans and rowspans, you may use this online table generator:
Generate tables in MediaWiki format - TablesGenerator.com
For example, this wiki markup
{| class="wikitable"
! colspan="3" | 1
! 2
! 3
|-
| rowspan="2" | A
| colspan="3" | B
| C
|-
| rowspan="2" colspan="2" | D
| colspan="2" | E
|-
| F
| G
| H
|}
will be rendered into this table:
| 1 | 2 | 3 | ||
|---|---|---|---|---|
| A | B | C | ||
| D | E | |||
| F | G | H | ||