Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Usage  



1.1  Background colour and non-header cells  





1.2  Spanning columns and rows, and collapsible and sortable tables  







2 Template data  





3 Technical notes  














Template:Diagonal split header






العربية
Asturianu

Беларуская
Bosanski
Català
Čeština
Deutsch
Ελληνικά
Español
فارسی
Français
Galego

Հայերեն
Bahasa Indonesia
Italiano

Magyar
Nederlands

Oʻzbekcha / ўзбекча
Polski
Português
Română
Русский

Simple English
Slovenčina
Slovenščina
Svenska

Türkçe
Українська
اردو
Tiếng Vit


 

Edit links
 









Template
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Permanently protected template

From Wikipedia, the free encyclopedia
 


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}}.

There are two variants of the template with different – and sadly incompatible – features:

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.

Wiki source Rendered result
{| class="wikitable"
! {{diagonal split header|From|To}}
! Solid !! Liquid !! Gas
|-
! Solid
| Solid-solid transformation || Melting || Sublimation=
|}

To

From

Solid Liquid Gas
Solid Solid-solid transformation Melting Sublimation=

Background colour and non-header cells

Diagonal split header only

A third parameter can be added to change the background colour from the standard header cell colour. Changing it to transparent (or another colour such as white, or #ffffff) lets the template be applied to non-header cells.

You may also indicate a second color in the fourth parameter (its default is the same as the third parameter), the first color being used for the lower left half of the cell, the second color being used for the upper right half of the cell.

Prefix it with | for data cells instead of ! for header cells, as in this Friend or Foe? payoff matrix:

Example

Pair 2

Pair 1

"Friend" (cooperate) "Foe" (defect)
"Friend" (cooperate)

1

1

2

0

"Foe" (defect)

0

2

0

0

Code
Wiki markup

{| class="wikitable" style="margin:0 auto;text-align:center;"
! {{diagonal split header| Pair 1 | {{color|#900|Pair 2}} | cyan | yellow}}
! style="width:6em;background:yellow;"| {{color|#900|"Friend" (cooperate)}}
! style="width:6em;background:yellow;"| {{color|#900|"Foe" (defect)}}
|-
! style="width:6em;background:cyan "| "Friend" (cooperate)
| {{diagonal split header|1| {{color|#900|1}} | transparent}}
| {{diagonal split header| 0 | {{color|#900|2}} | pink | palegreen}}
|-
! style="width:6em;background:cyan "| "Foe" (defect)
| {{diagonal split header|2| {{color|#900|0}} | palegreen | pink}}
| {{diagonal split header| 0 | {{color|#900|0}} | pink}}
|}

Spanning columns and rows, and collapsible and sortable tables

Diagonal split header 2 recommended

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 2 ...}}. 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.

In large table cells like this, use Diagonal split header 2 to produce a better-looking line, with the same thickness as the cell borders:

Example

n

City

2023 2024 
Dec Jan Feb
Roma Rome 8 1 6
Venezia Venice 3 5 7
Firenze Florence 4 9 2
Code
Wiki markup

{| class="wikitable sortable mw-collapsible" style="margin:0 auto;text-align:center;"
! colspan="2" rowspan="2" {{diagonal split header 2|City|''n''}}
! {{#expr:{{CURRENTYEAR}} - 1}}
! colspan="2"|{{CURRENTYEAR}}&nbsp;
|-
! Dec !! Jan !! Feb
|-
! Roma !! Rome
|8||1||6|-
! Venezia !! Venice
|3||5||7|-
! Firenze !! Florence
|4||9||2|}

Template data

Simulate a table header cell split diagonally

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Rows1

header of row headers, shown on the bottom left

Example
''Y-axis''
Stringrequired
Columns2

header of column headers, shown on the top right

Example
{{color|#6cf|X-axis}}
Stringrequired
Background colour3

Optional colour of background, use <code>transparent</code> for standard non-header background

Default
#eaecf0
Example
transparent
Stringoptional
Upper right background colour4

Optional colour of background for the upper right half of the cell, use <code>transparent</code> for standard non-header background

Default
same background colour as parameter 3, #eaecf0 otherwise
Example
transparent
Stringoptional

Technical notes


Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Diagonal_split_header&oldid=1060940825"

Category: 
Table cell templates
Hidden category: 
Wikipedia semi-protected templates
 



This page was last edited on 18 December 2021, at 16:54 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki