Help:Table: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
m Update link, slight cleanup
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Wikipedia}}
Tables can be used to layout contents horizontally and vertically. Tables can be made sortable, columns may be aligned, cells may be combined. See the following examples.
Tables can be used to layout contents horizontally and vertically. Tables can be made sortable, columns may be aligned, cells may be combined. See the following examples.


For basic usage see [[Help:Editing#Tables]].
For basic usage see [[Help:Editing#Tables]].


== Some Examples ==
== Some examples ==
 
=== Table layout without border lines ===
=== Table layout without border lines ===
Layout contents vertically and horizontally (without making obvious that you use tables for this). Using the exclamation mark (<code>!</code>) instead of the pipe symbol (<code>|</code>) center-aligns the cell text and sets it to '''bold''' face.
Layout contents vertically and horizontally (without making obvious that you use tables for this). Using the exclamation mark (<code>!</code>) instead of the pipe symbol (<code>|</code>) center-aligns the cell text and sets it to '''bold''' face.


Line 115: Line 114:
|-
|-
| 6  || 200 || Debussy loves it.
| 6  || 200 || Debussy loves it.
|}</nowiki>
|}</pre>


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 214: Line 213:
|-
|-
| Left aligned text
| Left aligned text
| Nothing to do (if the default is "left-align", this is mostly the case)<ref>If a column has other then left-aligned text, for example by <code>class="... right-all"</code> (see above section(s)), cell-specific inline [[CSS]] will prioritized highest</ref>
| Nothing to do (if the default is "left-align", this is mostly the case)<ref>If a column has other then left-aligned text, for example by <code>class="... right-all"</code> (see above section(s)), cell-specific inline [[CSS]] will prioritized highest, and use <code>style{{=}}"text-align: left;" {{pipe}}</code></ref>
|-
|-
| style="text-align:center;" | Centered text
| style="text-align:center;" | Centered text
Line 220: Line 219:
|-
|-
| style="text-align:right;" | Right aligned
| style="text-align:right;" | Right aligned
| Place <code>style{{=}}"text-align: center;" {{pipe}}</code> after the opening pipe
| Place <code>style{{=}}"text-align: right;" {{pipe}}</code> after the opening pipe
|-
|-
! Headline style
! Headline style
Line 235: Line 234:


{| class="wikitable"
{| class="wikitable"
|+ Compact syntax: one line per row
|+ style="font-size: 105%;" | Compact syntax: one line per row
|-
|-
! Wikitext
! Wikitext
! Rendered output
! Rendered output
|-
|-
| <syntaxhighlight lang="text">
| <pre>
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 247: Line 246:
|| 1|2 ||| 3|4
|| 1|2 ||| 3|4
|}
|}
</syntaxhighlight>
</pre>
|  
| {{(!}} class{{=}}"wikitable" style{{=}}"margin: auto auto auto auto;"
{| class="wikitable"
{{!-}}
!{{!}} A|X !!{{!}} B|Y
|-
|-
!| A|X !!| B|Y
{{!!}} 1|2 {{!}}{{!!}} 3|4
|-
{{!)}}
|| 1|2 ||| 3|4
|}
|}
|}


{| class="wikitable"
{| class="wikitable"
|+ "Airy" syntax: one line per cell
|+ style="font-size: 105%;" | "Airy" syntax: one line per cell
|-
|-
! Wikitext
! Wikitext
! Rendered output
! Rendered output
|-
|-
| <syntaxhighlight lang="text">
| <pre>
{| class="wikitable"
{| class="wikitable"
|-
!| A|X
!| A|X
!| B|Y
!| B|Y
Line 271: Line 270:
|| 3|4
|| 3|4
|}
|}
</syntaxhighlight>
</pre>
|
| {{(!}} class{{=}}"wikitable" style{{=}}"margin: auto auto auto auto;"
{{!-}}
!{{!}} A{{!}}X
!{{!}} B{{!}}Y
{{!-}}
{{!!}} 1{{!}}2
{{!!}} 3{{!}}4
{{!)}}
|}
 
Alternatively, pipe characters can be escaped using {{tlx|!}} or {{tlx|pipe}}:
 
{| class="wikitable"
|+ style="font-size: 105%;" | Using escapes
|-
! Wikitext
! Rendered output
|-
| <pre>
{| class="wikitable"
{| class="wikitable"
!| A|X
!| B|Y
|-
|-
|| 1|2
! A{{pipe}}X
|| 3|4
! B{{pipe}}Y
|-
| 1{{pipe}}2
| 3{{pipe}}4
|}
|}
</pre>
| {{(!}} class{{=}}"wikitable" style{{=}}"margin: auto auto auto auto;"
{{!-}}
! A{{pipe}}X
! B{{pipe}}Y
{{!-}}
{{!}} 1{{pipe}}2
{{!}} 3{{pipe}}4
{{!)}}
|}
|}


== Combining table cells ==
== Combining table cells ==
todo: internal description of colspans and rowspans
{{todo|inline=1|add examples|comment=internal description of colspans and rowspans}}


=== External helper tools ===
=== External helper tools ===
Line 333: Line 360:


== See also ==
== See also ==
* [[Help:Help]]
* [[Help:Introduction]]
* [[Help:Editing]]
* [[Help:Editing]]


[[Category:Help]]
[[Category:Help]]
[[Category:Todo:add examples|?]]