Difference between revisions of "Template:Diagonal split header/doc"

From blackwiki
Jump to navigation Jump to search
imported>Cmglee
(Improve example)
Line 5: Line 5:
 
This template simulates a table header cell split diagonally, a device often used to compactly label headers of rows and columns, as in this example:
 
This template simulates a table header cell split diagonally, a device often used to compactly label headers of rows and columns, as in this example:
 
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;"
 
{| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;"
! {{diagonal split header|&nbsp;&nbsp;Sex|&nbsp;&nbsp;Handed-<br />ness}} !! Right-<br />handed !! Left-<br />handed !! Total
+
! {{diagonal split header|From&nbsp;|To}} !! Solid !! Liquid !! Gas
 
|-
 
|-
! Male
+
! Solid
| 43 || || 52
+
| Solid-solid transformation || Melting || Sublimation
 
|-
 
|-
! Female
+
! Liquid
| 44 || || 48
+
| Freezing || &mdash; || Boiling/evaporation
 
|-
 
|-
! Total
+
! Gas
| 87 || 13 || 100
+
| Deposition || Condensation || &mdash;
 
|}
 
|}
  
 
To use it, create a header cell using <code>!</code> followed by <code><nowiki>{{diagonal split header|NATURE-OF-ROW-HEADERS|NATURE-OF-COLUMN-HEADERS}}</nowiki></code>.
 
To use it, create a header cell using <code>!</code> followed by <code><nowiki>{{diagonal split header|NATURE-OF-ROW-HEADERS|NATURE-OF-COLUMN-HEADERS}}</nowiki></code>.
  
As the effect is achieved by drawing a diagonal line across the cell, the two headers are still part of the same cell and can easily overrun the line. A remedy is to pad the headers with <code>&amp;nbsp;</code> as in the example above. The template user is responsible for checking that it does not overrun on common Web browsers.
+
As the effect is achieved by drawing a diagonal line across the cell, the two headers are still part of the same cell and can easily overrun the line. A remedy is to pad the headers with non-breaking spaces (<code>&amp;nbsp;</code>) and/or line breaks (<code>&lt;br /&gt;</code>), as in the example above. The template user is responsible for checking that it does not overrun on common Web browsers.
  
 
The template is compatible with collapsible tables, and cells using colspan or rowspan, in which case place the colspan/rowspan attribute between <code>!</code> and <code><nowiki>{{diagonal split header &hellip;}}</nowiki></code>. It is not compatible with sortable tables, as the sort arrows are not drawn, but this problem can be resolved by using a second header row:
 
The template is compatible with collapsible tables, and cells using colspan or rowspan, in which case place the colspan/rowspan attribute between <code>!</code> and <code><nowiki>{{diagonal split header &hellip;}}</nowiki></code>. It is not compatible with sortable tables, as the sort arrows are not drawn, but this problem can be resolved by using a second header row:
  
 
{| class="wikitable sortable collapsible" style="margin-left:auto;margin-right:auto;text-align:center;"
 
{| class="wikitable sortable collapsible" style="margin-left:auto;margin-right:auto;text-align:center;"
! colspan="2" rowspan="2" {{diagonal split header|''&theta;''|''T''}} !! colspan="2"|{{#expr:{{CURRENTYEAR}} - 1}} !! {{CURRENTYEAR}}
+
! colspan="2" rowspan="2" {{diagonal split header|Township|''n''<br />}} !! colspan="2"|{{#expr:{{CURRENTYEAR}} - 1}} !! {{CURRENTYEAR}}
 
|-
 
|-
 
! Nov !! Dec !! Jan
 
! Nov !! Dec !! Jan
 
|-
 
|-
! data-sort-value="1" | 0 !! 0&deg;
+
! Aoraki !! Mount Cook
| &#10004; || &#10008;|| &#10007;
+
| 8 || 1 || 6
 
|-
 
|-
! data-sort-value="2" | {{pi}}/2 !! 90&deg;
+
! Aparima !! Riverton
| &#10003; || &#10007; || &#10008;
+
| 3 || 5 || 7
 
|-
 
|-
! data-sort-value="3" | {{pi}} !! 180&deg;
+
! Waiau !! Franz Josef
| &#10004; || &#10004; || &#10003;
+
| 4 || 9 || 2
 
|}
 
|}
  

Revision as of 11:37, 6 July 2017

Usage

This template simulates a table header cell split diagonally, a device often used to compactly label headers of rows and columns, as in this example:

To
From 
Solid Liquid Gas
Solid Solid-solid transformation Melting Sublimation
Liquid Freezing Boiling/evaporation
Gas Deposition Condensation

To use it, create a header cell using ! followed by {{diagonal split header|NATURE-OF-ROW-HEADERS|NATURE-OF-COLUMN-HEADERS}}.

As the effect is achieved by drawing a diagonal line across the cell, the two headers are still part of the same cell and can easily overrun the line. A remedy is to pad the headers with non-breaking spaces (&nbsp;) and/or line breaks (<br />), as in the example above. The template user is responsible for checking that it does not overrun on common Web browsers.

The template is compatible with collapsible tables, and cells using colspan or rowspan, in which case place the colspan/rowspan attribute between ! and {{diagonal split header …}}. It is not compatible with sortable tables, as the sort arrows are not drawn, but this problem can be resolved by using a second header row:

n
Township
2024 2025
Nov Dec Jan
Aoraki Mount Cook 8 1 6
Aparima Riverton 3 5 7
Waiau Franz Josef 4 9 2

Template data

simulate a table header cell split diagonally

Template parameters

ParameterDescriptionTypeStatus
Rows1

header of row headers, shown on the bottom left

Stringoptional
Columns2

header of column headers, shown on the top right

Stringoptional
Label3

optional extra header content, shown at the center

Stringoptional