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

From blackwiki
Jump to navigation Jump to search
imported>Crissov
(cat.)
imported>Voidxor
(Clarify, as "headers of headers" is potentially confusing. Fix syntax.)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 +
 
== Usage ==
 
== 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:
 
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;"
Line 16: Line 16:
 
| 87 || 13 || 100
 
| 87 || 13 || 100
 
|}
 
|}
To use it, create a header cell using <code>!</code> followed by <code><nowiki>{{diagonal split header|HEADER-OF-ROW-HEADERS|HEADER-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 <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.
  
 
The template is compatible with collapsible (but not sortable, as the sort arrows are not drawn) 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>:
 
The template is compatible with collapsible (but not sortable, as the sort arrows are not drawn) 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>:
 +
 
{| 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"|2015 !! 2016
 
! colspan="2" rowspan="2" {{diagonal split header|''&theta;''|''T''}} !! colspan="2"|2015 !! 2016
Line 62: Line 64:
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Table cell templates}}
+
[[Category:Table cell templates]]
 
}}</includeonly>
 
}}</includeonly>

Revision as of 02:57, 4 March 2016

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:

  Handed-
ness
  Sex
Right-
handed
Left-
handed
Total
Male 43 9 52
Female 44 4 48
Total 87 13 100

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 &nbsp; 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 (but not sortable, as the sort arrows are not drawn) tables, and cells using colspan or rowspan, in which case place the colspan/rowspan attribute between ! and {{diagonal split header …}}:

T
θ
2015 2016
Nov Dec Jan
0
Template:Pi/2 90°
Template:Pi 180°

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