Template:Aligned table/doc

From PsychonautWiki
Jump to navigation Jump to search

Full syntax

For parameter explanations, see table below.

{{Aligned table
| fullwidth = 
| class = 
| style = 
| cols =  
| colwidth = 
<!-- | colstyle = -->
| leftright = 
| rowstyle = 

<!--(for Cth column:)-->
| colCwidth = 
| colCclass = 
| colCalign = 
| colCstyle = 
| colCnowrap = 

<!--(for Rth row:)-->
| rowRclass = 
| rowRstyle = 

<!--(for cell R,C:)-->
| classR.C = 
| styleR.C = 

| (cell 1,1) | (cell 1,2) | ... | ...
}}
Parameter Description Examples Default
<syntaxhighlight lang="text" enclose="none">fullwidth</syntaxhighlight>
Set to anything ("on", "yes", "true", ...) to ensure table spans entire width available. 
(Effect is to remove border-spacing and add width:100% to the table's styling.)
|fullwidth=on not set
<syntaxhighlight lang="text" enclose="none">class</syntaxhighlight> Class for the table |class=wikitable  |class=infobox  |class=sidebar  etc. none
<syntaxhighlight lang="text" enclose="none">style</syntaxhighlight> CSS styling for the table |style=width:80%;background:transparent; none
<syntaxhighlight lang="text" enclose="none">cols</syntaxhighlight> Number of columns in the table |cols=4 2
<syntaxhighlight lang="text" enclose="none">colwidth</syntaxhighlight> Width of each column |colwidth=6.0em  |colwidth=25%  etc. not set
  •  <syntaxhighlight lang="text" enclose="none">leftright</syntaxhighlight>
col1align=left and
|col2align=right.
  •  |leftright=on
  • not set
<syntaxhighlight lang="text" enclose="none">rowstyle</syntaxhighlight> CSS styling for each row |rowstyle=text-align:center; not set
<syntaxhighlight lang="text" enclose="none">col[C]width</syntaxhighlight> Width of column number [C] |col2width=6.0em  |col3width=25%  etc. not set
<syntaxhighlight lang="text" enclose="none">col[C]class</syntaxhighlight> Class for the cells in column number [C] |col1class=navbox-group none
<syntaxhighlight lang="text" enclose="none">col[C]align</syntaxhighlight> Alignment (left, right, center) for column [C]'s cell contents. |col4align=right not set
  • <syntaxhighlight lang="text" enclose="none">col[C]style</syntaxhighlight>
  •  <syntaxhighlight lang="text" enclose="none">col[C]nowrap</syntaxhighlight>
  • CSS styling for column [C]'s cells.
  • Set to anything ("on", "yes", "true", ...) to add white-space:nowrap to column
    [C]'s cell styling (i.e. prevent lines within its cells from wrapping).
  • |col3style=background:lavender;
  •  |col1nowrap=on
  • none
  • not set
<syntaxhighlight lang="text" enclose="none">row[R]class</syntaxhighlight> Class for the cells in row [R] |row10class=navbox-abovebelow none
<syntaxhighlight lang="text" enclose="none">row[R]style</syntaxhighlight> CSS styling for cells in row [R] |row1style=font-weight:bold; none
<syntaxhighlight lang="text" enclose="none">class[R].[C]</syntaxhighlight> Class for the cell in row [R], column [C]. Overrides any other class attribution (<syntaxhighlight lang="text" enclose="none">col[C]class, row[R]class</syntaxhighlight>). none
<syntaxhighlight lang="text" enclose="none">style[R].[C]</syntaxhighlight> CSS styling for the cell in row [R], column [C]. Overrides any more generalized styling (<syntaxhighlight lang="text" enclose="none">leftright, col[C]align, row[R]style</syntaxhighlight>, etc). none
Unnamed parameters Each unnamed parameter is taken to be the next cell in the table, starting at the table's top left corner and working left to right from top to bottom.

Examples

{{Aligned table
|class=wikitable
|cols=3
| A | 1 | a
| B | 2 | b
}}
A 1 a
B 2 b
{{Aligned table
|class=wikitable
|cols=4
|col1align=center
|col2align=center
|col3align=right
|col4align=right
| AAA | aa    | 123  | 12345
| B   | bbbbb | 1234 | 2
}}
AAA aa 123 12345
B bbbbb 1234 2
{{Aligned table
|class=wikitable
|style=width:20em
|cols=2
|col1align=center
|col2align=right
| AAA | 123
| B | 2
}}
AAA 123
B 2

See also