Template:Diagonal split header/doc

< Template:Diagonal split header
自由之民讨论 | 贡献2022年3月18日 (五) 14:29的版本 (文本替换 - 替换“{{template doc page viewed directly}}</noinclude>”为“{{template doc page viewed directly}}</noinclude>[[en:{{FULLPAGENAME}}]]”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
这是 Template:Diagonal split header模板文档
当直接浏览时,使用变量可能会失效,请不要使用硬编码来代替页面名或地址。

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;), line breaks (<br />), and/or CSS (escape = signs as {{=}}), as in the example above. The template user is responsible for checking that it does not overrun on common Web browsers.

Spanning columns and rows, and collapsible and sortable tables

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
  City
2023 2024 
Dec Jan Feb
Roma Rome 8 1 6
Venezia Venice 3 5 7
Firenze Florence 4 9 2

Template data

# Label Description Example Type Required
1 Rows Header of row headers, shown on the bottom left Y-axis string true
2 Columns Header of column headers, shown on the top right X-axis string true
3 Background colour Optional colour of background, use transparent for standard non-header background. Default = #eaecf0 transparent string false

See also