Template:Vertical header

From Wikimedia Commons, the free media repository
(Redirected from Template:Vert header)
Jump to navigation Jump to search
Sample text
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Vertical header/doc.

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

Usage

{{Vertical header |1= |nb= |va= |stp= |mw= |style= |cellstyle= }}

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.

Template parameters

ParameterDescriptionDefaultStatus
1The desired text; can contain wikilinks ([[]]). You can escape the equals sign either by using {{=}} or by explicitly mentioning the |1= parameter.emptyrequired
nbGive any non-empty value in order to apply a {{nobold}} template to the text.emptyoptional
vaVertical alignment (bottom, top, middle). Default is bottom.bottomoptional
stpGive 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).emptyoptional
mwManual width; override the default value, which was automatically generated based on the number of line breaks (you can use <br>, <BR /> or any other combination).emptyoptional
styleAdditional styles for the <div/> containing the rotated text. May contain double quotes.emptyoptional
cellstyleAdditional styles for the entire cell. May contain double quotes. Use this instead of the cell's style attribute. Use background-color instead of background if you need it for the header of a sortable column.emptyoptional
Template data
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

This is a template that helps create vertically-oriented column headers in tables. It even works for [[w:Help:Sorting|sortable]] columns.

[Edit template data]

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
1

The desired text; can contain wikilinks

Linerequired
cellstyle

Additional styles for the entire cell. May contain double quotes. Use this instead of the cell's style attribute. Use background-color instead of background if you need it for the header of a sortable column.

Lineoptional
mw

Manual width; override the default value, which was automatically generated based on the number of line breaks

Lineoptional
nb

Give any non-empty value in order to apply a nobold template to the text.

Booleanoptional
stp

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).

Booleanoptional
style

Additional styles for the div containing the rotated text. May contain double quotes.

Lineoptional
va

Vertical alignment

Suggested values
bottom top middle
Default
bottom
Lineoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:

Localization

This template is not intended to be localized.


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


Examples

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

You can also use the ! {{verth|Your text here}} shorthand.

An example below (from w:Help:Sorting) with headers that span rows or columns (using rowspan and colspan). Note that there is no vertical bar | between rowspan=2 and {{vert header...}}

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
|}

Compatibility

The following browsers have been tested on combinations of Debian 6.0, Mac OS X 10.8, Ubuntu 9.10, Ubuntu 15.04, Windows 7, Windows Server 2008 R2 and Windows 10. The earliest version known to work is highlighted in green. The latest tested configuration that did not work is highlighted in red.

Arora Chrome Dillo Edge Epiphany Firefox Iceape Iceweasel IE Konqueror Luakit Midori Opera Rekonq Safari SeaMonkey
Symbol support vote.svg 0.11
27 Sep 10
Symbol support vote.svg 9
4 Feb 11
Norsk bokmål: 3.0.4
9 Apr 14
Symbol support vote.svg 38
2 Aug 16
Symbol support vote.svg 3.4.2
19 May 12
Symbol support vote.svg 43
15 Dec 15
Norsk bokmål: 2.7.12
19 Jan 13
Symbol support vote.svg 38.6
11 Feb 16
Symbol support vote.svg 11
17 Oct 13
Symbol support vote.svg 4.14
20 Aug 14
Symbol support vote.svg 039e319
13 Sep 12
Symbol support vote.svg 0.4.3
6 Nov 14
Symbol support vote.svg 15
2 Jul 13
Symbol support vote.svg 1.1
27 Aug 12
Symbol support vote.svg 9.1
21 Mar 16
Symbol support vote.svg 2.46
22 Dec 16
Deb 6 Win 7 Ubu 15.04 Win 10 Deb 6 OS X 10.8 Deb 6 Deb 6 Win 10 Ubu 15.04 Ubu 15.04 Ubu 15.04 Win 2008 R2 Ubu 9.10 OS X 10.8 Ubu 15.04
Should theoretically work on the following browsers as well (please confirm):
Android
Browser
Chrome Edge Firefox Safari
3
22 Feb 11
8
2 Dec 10
20
29 Jul 15
41
22 Sep 15
5.1
20 Jul 11
Notes:
  • In Internet Explorer 5–10, the text goes from top to bottom instead of going from bottom to top.
  • Firefox support for vertical text and rotation began in version 25, but it was unstable until version 43, or possibly 41.