Template:Table alignment/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a documentation subpage for Template:Table alignment.
It contains usage information, categories and other content or metadata that is not part of the original template.
This template uses TemplateStyles:

Purpose

This template facilitates alignment of text within table cells both by default and per-column

Usage

Insert {{Table alignment}} immediately before the table and add {{classname}}s to the table as desired

classname Function
defaultcenter Align text in all table cells to center by default
defaultleft Align text in all table cells to left by default
defaultright Align text in all table cells to right by default
colNcenter Align text in column N to center
colNleft Align text in column N to left
colNright Align text in column N to right

The col class overrides the default class.

By default, header cell content is always centered unless individually overridden.

The col and default classes do not apply to header cells if the wikitable class is used.

Limitations

  • Only column numbers up to col99 are supported.
  • May not function as expected on tables using rowspan or colspan

Example

{{Table alignment}}
{| class="wikitable defaultcenter col1left col4right"
!Column 1
!Column 2
!Column 3
!Column 4
|-
|A||1||4||X
|-
|B||2||5||Y
|-
|C||3||6||Z
|}
Column 1 Column 2 Column 3 Column 4
A 1 4 X
B 2 5 Y
C 3 6 Z

Attribution

This is a modified version of (Wikipedia) Template: Table alignment