Template:Vertical header/doc

From WikiNET
Jump to navigation Jump to search

Template:Mbox

Regular column
Vertical value column
Thin gold column
Unsortable column
0
1
1 2
3
5
8 13
Regular column
Vertical value column
Thin gold column
Unsortable column

This is a template that helps create vertically oriented column headers in tables. It even works for sortable columns.

Although this template was made with table headers in mind, it can work with regular cells as well.

If the header cells have other attributes, for example, colspan or rowspan, there must be no vertical bar | between the attributes and the template call.

Parameter list

  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">1</syntaxhighlight> – The desired text; can contain wikilinks (<syntaxhighlight lang="text" class="" id="" style="" inline="1">[[]]</syntaxhighlight>). You can escape the equals sign either by using {{=}} or by explicitly mentioning the <syntaxhighlight lang="text" class="" id="" style="" inline="1">1=</syntaxhighlight> parameter.
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">nb</syntaxhighlight> – Give any non-empty value in order to apply a {{nobold}} template to the text.
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">va</syntaxhighlight> – Vertical alignment (<syntaxhighlight lang="text" class="" id="" style="" inline="1">bottom</syntaxhighlight>, <syntaxhighlight lang="text" class="" id="" style="" inline="1">top</syntaxhighlight>, <syntaxhighlight lang="text" class="" id="" style="" inline="1">middle</syntaxhighlight>). Default is <syntaxhighlight lang="text" class="" id="" style="" inline="1">bottom</syntaxhighlight>.
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">stp</syntaxhighlight> – Give any non-empty value in order to apply a top padding to the cell (useful if the header is bottom-aligned; required for sortable columns).
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">mw</syntaxhighlight> – Manual width; override the default value, which was automatically generated based on the number of line breaks (you can use <syntaxhighlight lang="text" class="" id="" style="" inline="1">
    </syntaxhighlight>, <syntaxhighlight lang="text" class="" id="" style="" inline="1">
    </syntaxhighlight> or any other combination).
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">style</syntaxhighlight> – Additional styles for the <syntaxhighlight lang="text" class="" id="" style="" inline="1">
    </syntaxhighlight> containing the rotated text. May contain double quotes.
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">cellstyle</syntaxhighlight> – Additional styles for the entire cell. May contain double quotes. Use this instead of the cell's <syntaxhighlight lang="text" class="" id="" style="" inline="1">style</syntaxhighlight> attribute. Use <syntaxhighlight lang="text" class="" id="" style="" inline="1">background-color</syntaxhighlight> instead of <syntaxhighlight lang="text" class="" id="" style="" inline="1">background</syntaxhighlight> if you need it for the header of a sortable column.

Examples

  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">! {{vert header|Your text here}}</syntaxhighlight> – basic example
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">! {{vert header|nb=1|stp=1|Your text here}}</syntaxhighlight> – produces an explicitly sortable, no-bold, sortable header
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">! {{vert header|va=top|Your text here}}</syntaxhighlight> – produces an unsortable, top-aligned table header
  • <syntaxhighlight lang="text" class="" id="" style="" inline="1">! colspan="2" {{vert header|cellstyle=background-color:gold|Your text here}}</syntaxhighlight> – produces an unsortable header spanning two columns, with a gold background; use no vertical bar after <syntaxhighlight lang="text" class="" id="" style="" inline="1">colspan</syntaxhighlight>

You can also use the <syntaxhighlight lang="text" class="" id="" style="" inline="1">! {{verth|Your text here}}</syntaxhighlight> shorthand.

An example below (from Help:Sorting) with headers that span rows or columns (using rowspan and colspan). Note that there is no vertical bar <syntaxhighlight lang="text" class="" id="" style="" inline="1">|</syntaxhighlight> between <syntaxhighlight lang="text" class="" id="" style="" inline="1">rowspan=2</syntaxhighlight> and <syntaxhighlight lang="text" class="" id="" style="" inline="1">{{vert header...}}</syntaxhighlight>

name
data columns
another column
data
more data
cats 273 53 1
dogs 65 8,492 2
mice 1,649 548 3
{| class="wikitable sortable"
|-
! rowspan=2 {{vert header|stp=1|name}}
! colspan=2 {{vert header|data columns}}
! rowspan=2 {{vert header|stp=1|another column}}
|-
! {{vert header|stp=1|data}}
! {{vert header|stp=1|more data}}
|-
| cats
| 273
| 53
| 1
|-
| dogs
| 65
| 8,492
| 2
|-
| mice
| 1,649
| 548
| 3
|}

See also