Difference between revisions of "Template:Diagonal split header"
imported>Cmglee (Document) |
imported>Cmglee (Update compatibility documentation) |
||
| Line 1: | Line 1: | ||
| − | <includeonly>style="background:linear-gradient(to top right,#f2f2f2 49%,# | + | <includeonly>style="background:linear-gradient(to top right,#f2f2f2 49%,#aaa,#f2f2f2 51%)"|<div style="margin-left:2em;text-align:right;">{{{2}}}</div>{{{3|}}}<div style="margin-right:2em;text-align:left;">{{{1}}}</div></includeonly><noinclude> |
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| Sex| Handed-<br />ness}} !! Right-handed !! Left-handed !! Total | + | ! {{diagonal split header| Sex| Handed-<br />ness}} !! Right-<br />handed !! Left-<br />handed !! Total |
|- | |- | ||
! Male | ! Male | ||
| Line 15: | Line 15: | ||
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|HEADER-OF-ROW-HEADERS|HEADER-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 | + | 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>&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 cells using colspan or rowspan, in which case place the colspan/rowspan attribute between <code>!</code> and <code><nowiki>{{diagonal split header …}}</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 …}}</nowiki></code>: |
| − | {| class="wikitable" 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|''θ''|'' | + | ! colspan="2" rowspan="2" {{diagonal split header|''θ''|''T''}} !! colspan="2"|2015 !! 2016 |
|- | |- | ||
| − | ! | + | ! Nov !! Dec !! Jan |
|- | |- | ||
| − | ! 0 !! 0° | + | ! {{hs|1}} 0 !! 0° |
| − | | &# | + | | ✔ || ✘|| ✗ |
|- | |- | ||
| − | ! {{pi}}/2 !! 90° | + | ! {{hs|2}} {{pi}}/2 !! 90° |
| − | | &# | + | | ✓ || ✗ || ✘ |
|- | |- | ||
| − | ! {{pi}} !! 180° | + | ! {{hs|3}} {{pi}} !! 180° |
| ✔ || ✔ || ✓ | | ✔ || ✔ || ✓ | ||
|} | |} | ||
</noinclude> | </noinclude> | ||
Revision as of 02:00, 10 January 2016
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|HEADER-OF-ROW-HEADERS|HEADER-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 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 | 0° | ✔ | ✘ | ✗ |
| Template:Pi/2 | 90° | ✓ | ✗ | ✘ |
| Template:Pi | 180° | ✔ | ✔ | ✓ |