Template:Vertical header

From Wikidata
Jump to navigation Jump to search
Sample text
Documentation icon Template documentation[view · edit · history · purge ]

This template simplifies the creation of table cells (typically headers, including those in sortable tables) with vertically-oriented contents. Although this template was created to produce table header cell specifically, there is nothing to impede its use for standard table cells as well, if desired.

Usage[edit]

This template must be called within already defined wikitext table syntax (after {| but before |}), and after a cell delimiter character (either | or !). If a cell has other attributes, for example class=, colspan= or rowspan=, there must be no vertical bar (|) between them and the template call. Any CSS style properties desired must be supplied as the value of the |cellstyle= parameter, including the terminating semicolon (;) for each.

Parameters[edit]

Regular column
Vertical value column
Unbolded gold column
Unsortable column
0
1
1 2
3
5
8 13
Regular column
Vertical value column
Unbolded gold column
Unsortable column
  • |text or |1=text – The cell's contents (shown here as text), which can contain wikilinks. You can escape the equality sign either by using {{=}} when the parameter is unnamed (a/k/a positional, as |text), or by explicitly supplying it as the value for the |1= parameter.
  • |unbold= – When any non-empty value is assigned, header cells will have their default bold appearance removed.
  • |align= – Controls the vertical alignment of the cell's contents, with valid values of: bottom (default), top and middle).
  • |sortable= – Applies extra padding to the cell when assigned any non-empty value, accounting for the arrows shown on sortable table column headers and footers (most useful when headers are bottom-aligned, and required for sortable columns).
  • |width= – Overrides cell width, which is otherwise automatically generated based on the number of line breaks present in the cell's contents (<BR>, <br /> or any other form of valid HTML line breaks are correctly parsed).
  • |style= – Additional CSS style properties for the <div>...</div> tags containing the rotated text (may contain quotation marks ").
  • |cellstyle= – Additional CSS style properties for the entire cell (may contain quotation marks "). Use this instead of the cell's style= attribute, which is wholly generated by this template. Use the CSS3 background-color: property instead of background or bgcolor, if you wish to override the default cell color.

Examples[edit]

  •  ! {{Vertical header|Your text here}} – Basic example
  •  ! {{Vertical header|unbold=yes|sortable=yes|Your text here}} – Produces an explicitly sortable, unbolded header
  •  ! {{Vertical header|align=top|Your text here}} – Produces an unsortable, top-aligned table header
  •  ! colspan="2" {{Vertical header|cellstyle=background-color: Gold;|Your text here}} – Produces an unsortable header spanning two columns with a gold background (note there is no vertical bar after colspan="2").

The example below demonstrates headers that span rows and columns (using rowspan= and colspan=).

Wikitext Parsed output
{| class="wikitable sortable"
 |-
 ! rowspan="2" {{Vertical header|sortable=yes|Name}}
 ! colspan="2" {{Vertical header|Data columns}}
 ! rowspan="2" {{Vertical header|sortable=yes|Another column}}
 |-
 ! {{Vertical header|sortable=yes|Data}}
 ! {{Vertical header|sortable=yes|More data}}
 |-
 ! Cats
 | 273
 | 53
 | 1
 |-
 ! Dogs
 | 65
 | 8,492
 | 2
 |-
 ! Varmints
 | 1,649
 | 548
 | 3
|}
Name
Data columns
Another column
Data
More data
Cats 273 53 1
Dogs 65 8,492 2
Varmints 1,649 548 3

Notes[edit]

  • In Internet Explorer versions 5–10, the baseline of the contents is on the opposite side (text flows from top to bottom with the baseline on the left).
  • Firefox support for vertical text and rotation began in version 25 (released October 2013), but it was unstable until version 41 (released September 2015), and incomplete until version 43 (released December 2015).

TemplateData[edit]

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Vertical header

Creates of wikitable cells (typically headers, including those in sortable tables) with vertically-oriented contents

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Cell contents1

The text to appear vertically inside the cell

Example
Example text
Stringrequired
Sortable table headersortable

Creates a cell with the necessary properties and spacing for a header (or footer) in a table with 'class=sortable', otherwise do not define

Suggested values
yes on true 1
Example
yes
Lineoptional
Alignmentalign

Set the alignment of the cell's contents, defaults to 'bottom' (appropriate for table headers) but other valid values are 'middle' (appropriate for normal table cells) and 'top' (appropriate for footers)

Suggested values
bottom middle top
Default
bottom
Example
top
Lineoptional
Cell heightwidth

Sets an explicit maximum for the cell's height (would be called its width in a normal, horizontally displayed cell) in any valid CSS3 length unit (such as px, em, %, vw, vh, etc.)

Example
24em
Lineoptional
Text weightunbold

Overrides the default boldness applied to table headers and footers when set to an non-empty value, otherwise leave undefined

Suggested values
yes on true 1
Example
yes
Lineoptional
Text stylestyle

Allows additional CSS3 style properties to be defined for the <div> tags which enclose the cell's contents, leaving the cell itself undisturbed, must include the terminating semicolon for each

Example
text-decoration: underline;
Lineoptional
Cell stylecellstyle

Allows additional CSS3 properties to be defined for the cell itself, also affecting the contents; must include the terminating semicolon for each

Example
padding: 0.8em 0.4em;
Lineoptional