Template:Table alignment
Jump to navigation
Jump to search
Page Template:Table alignment/tables.css must have content model "Sanitized CSS" for TemplateStyles (current model is "CSS").
This documentation is transcluded from Template:Table alignment/doc. (Edit | history)
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
![]() | This template relies on the TemplateStyles MediaWiki extension, which is not currently installed. As such, this template is currently nonfunctional. |
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
orcolspan
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 |}
Page Template:Table alignment/tables.css must have content model "Sanitized CSS" for TemplateStyles (current model is "CSS").
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