<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://battleint.net/index.php?action=history&amp;feed=atom&amp;title=Template%3ASticky_header%2Fdoc</id>
	<title>Template:Sticky header/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://battleint.net/index.php?action=history&amp;feed=atom&amp;title=Template%3ASticky_header%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://battleint.net/index.php?title=Template:Sticky_header/doc&amp;action=history"/>
	<updated>2026-11-26T22:53:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://battleint.net/index.php?title=Template:Sticky_header/doc&amp;diff=170625&amp;oldid=prev</id>
		<title>imported&gt;Deadfire: creation</title>
		<link rel="alternate" type="text/html" href="https://battleint.net/index.php?title=Template:Sticky_header/doc&amp;diff=170625&amp;oldid=prev"/>
		<updated>2024-11-08T18:54:05Z</updated>

		<summary type="html">&lt;p&gt;creation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{Template redirect|sticky-header}}&lt;br /&gt;
{{uses TemplateStyles|Template:Sticky header/styles.css}}&lt;br /&gt;
&lt;br /&gt;
This template makes a table&amp;#039;s column headers stick to the top of the screen as the table&amp;#039;s data is scrolled in and out of view. It&amp;#039;s used on tall tables that have column headers that might be difficult to remember as you scroll through the data.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
Include this template by adding {{tlc|sticky header}} or its redirect {{tlc|sticky-header}} above a table. Add one of the following classes to the table start wikitext.&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;background-color: white;&amp;quot;&lt;br /&gt;
|+ Classes for table start wikitext: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{|&amp;lt;/nowiki&amp;gt; class=&amp;quot;&amp;#039;&amp;#039;class1 class2&amp;#039;&amp;#039;&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
! Class&lt;br /&gt;
! Summary&lt;br /&gt;
|-&lt;br /&gt;
| class=nowrap | &amp;lt;code&amp;gt;sticky-header&amp;lt;/code&amp;gt;&lt;br /&gt;
| Make the first header row top sticky.&lt;br /&gt;
|-&lt;br /&gt;
| class=nowrap | &amp;lt;code&amp;gt;sticky-header-multi&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;strong&amp;gt;Requires sortable table&amp;lt;/strong&amp;gt;. Make multiple header rows top sticky. Avoid use with the &amp;lt;code&amp;gt;sorttop&amp;lt;/code&amp;gt; class that becomes sticky after sorting. Avoid making headers sticky that aren&amp;#039;t for the entire table (ex. section header rows). Avoid making excessively tall header rows sticky that might block too much data on short screens (ex. mobile landscape).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Single sticky header row ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;sticky-header&amp;lt;/code&amp;gt; class is used to make the first header row top sticky. Sortable is not required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! Color !! A !! B&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; | C&lt;br /&gt;
|- class=sorttop&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Max&amp;#039;&amp;#039;&amp;#039; || 10 || 11 || 12&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Total&amp;#039;&amp;#039;&amp;#039; || 22 || 26 || 30&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wikitext highlight=1-2&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! Color !! A !! B&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; | C&lt;br /&gt;
|- class=sorttop&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Max&amp;#039;&amp;#039;&amp;#039; || 10 || 11 || 12&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Total&amp;#039;&amp;#039;&amp;#039; || 22 || 26 || 30&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple sticky header rows ==&lt;br /&gt;
The &amp;lt;code&amp;gt;sticky-header-multi&amp;lt;/code&amp;gt; class is used to make multiple header rows top sticky. &amp;#039;&amp;#039;&amp;#039;Sortable table is required&amp;#039;&amp;#039;&amp;#039; since sortable is currently the only way to move consecutive rows of column headers to the {{Tag|thead|o}} element. If some or all columns should not be sortable, then &amp;lt;code&amp;gt;class=unsortable&amp;lt;/code&amp;gt; can be put in the header cell with the sorting icon. Table top will still be sticky. See [[Help:Sortable tables]]. If [[w:JavaScript|JavaScript]] is disabled, then sortable and this solution won&amp;#039;t work. &lt;br /&gt;
&lt;br /&gt;
Avoid using the &amp;lt;code&amp;gt;sorttop&amp;lt;/code&amp;gt; class since sortable moves those rows into the {{Tag|thead|o}} element after sorting, which makes them top sticky too. A solution might be to move them to the bottom and use the &amp;lt;code&amp;gt;sortbottom&amp;lt;/code&amp;gt; class instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header-multi&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! rowspan=2 | Color&lt;br /&gt;
! colspan=3 | Data&lt;br /&gt;
|-&lt;br /&gt;
! A !! B&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; | C&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Max&amp;#039;&amp;#039;&amp;#039; || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Total&amp;#039;&amp;#039;&amp;#039; || 22 || 26 || 30&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wikitext highlight=1-2&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header-multi&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! rowspan=2 | Color&lt;br /&gt;
! colspan=3 | Data&lt;br /&gt;
|-&lt;br /&gt;
! A !! B&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; | C&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Max&amp;#039;&amp;#039;&amp;#039; || 10 || 11 || 12&lt;br /&gt;
|- class=sortbottom&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Total&amp;#039;&amp;#039;&amp;#039; || 22 || 26 || 30&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Header rows not for whole table ===&lt;br /&gt;
&lt;br /&gt;
Consecutive rows of column headers are top sticky, so avoid adding a row of headers right under the column headers that don&amp;#039;t apply to the entire table such as a section header meant to visually separate the table.&lt;br /&gt;
&lt;br /&gt;
A solution might be to move each section to a column or separate tables, which also avoids accessibility issues.&lt;br /&gt;
&lt;br /&gt;
Another solution might be to add a blank row of data cells (&amp;lt;code&amp;gt;| colspan=4 |&amp;lt;/code&amp;gt;) between the last column header row and the first section header row so the latter is not included in the consecutive header rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header-multi&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! rowspan=2 | Color&lt;br /&gt;
! colspan=3 | Data&lt;br /&gt;
|-&lt;br /&gt;
! A !! B !! C&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 |&lt;br /&gt;
|-&lt;br /&gt;
! colspan=4 | Section 1&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
! colspan=4 | Section 2&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; vertical-align:top;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wikitext highlight=1-2,9-10&amp;gt;&lt;br /&gt;
{{sticky header}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sticky-header-multi&amp;quot;&lt;br /&gt;
|+ Caption&lt;br /&gt;
|-&lt;br /&gt;
! rowspan=2 | Color&lt;br /&gt;
! colspan=3 | Data&lt;br /&gt;
|-&lt;br /&gt;
! A !! B !! C&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 |&lt;br /&gt;
|-&lt;br /&gt;
! colspan=4 | Section 1&lt;br /&gt;
|-&lt;br /&gt;
| Red || 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
| Lime || 4 || 5 || 6&lt;br /&gt;
|-&lt;br /&gt;
! colspan=4 | Section 2&lt;br /&gt;
|-&lt;br /&gt;
| Gold || 7 || 8 || 9&lt;br /&gt;
|-&lt;br /&gt;
| Blue || 10 || 11 || 12&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Excessively tall header rows ===&lt;br /&gt;
&lt;br /&gt;
Avoid excessively tall header rows that might block too much or all data when sticky on a small mobile screen, especially in [[w:Page orientation|landscape orientation]]. Some solutions might be to move some of the header text to the table caption, more concise header text, remove line-breaks ({{Tag|br|o}}) in the headers, or split the table up into smaller tables to reduce headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-grid; overflow-y: scroll; max-height: 300px;&amp;quot;&amp;gt;&lt;br /&gt;
{{sticky header}}{{sort under}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable sort-under sticky-header-multi&amp;quot; style=&amp;quot;margin: 0;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! colspan=4 | Header&amp;lt;br&amp;gt;group&amp;lt;br&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
! colspan=2 | Header&amp;lt;br&amp;gt;group&amp;lt;br&amp;gt;2&lt;br /&gt;
! colspan=2 | Header&amp;lt;br&amp;gt;group&amp;lt;br&amp;gt;3&lt;br /&gt;
|-&lt;br /&gt;
! Header&amp;lt;br&amp;gt;1 !! Header&amp;lt;br&amp;gt;2 !! Header&amp;lt;br&amp;gt;3 !! Header&amp;lt;br&amp;gt;4&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|-&lt;br /&gt;
| data || data || data || data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
{{see|w:Template:Sticky_header/doc#Known_issues}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* {{slink|w:Help:Table/Advanced#Tables with sticky headers}}&lt;br /&gt;
* {{t|sticky table start}} - allows sticky rows and columns inside a scrollable area.&lt;br /&gt;
* {{t|shy}} – Can be used to help narrow columns by adding a [[w:soft hyphen|soft hyphen]] to a word to allow it to wrap.&lt;br /&gt;
&lt;br /&gt;
More [[w:WP:template styles|template styles]] for tables:&lt;br /&gt;
* {{t|sort under}} - moves the sorting arrows under the headers.&lt;br /&gt;
* {{t|row hover highlight}} - adds row hover highlighting, and option for white background. &lt;br /&gt;
* {{t|static row numbers}} - adds a column of row numbers to a table.&lt;br /&gt;
* {{t|table alignment}} - aligns the cells in a column, or a whole table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Table templates]]&lt;br /&gt;
[[Category:Templates using TemplateStyles to style external elements]]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Deadfire</name></author>
	</entry>
</feed>