模板:Vertical header/doc:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
无编辑摘要
Kangkk​(留言 | 贡献)
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
{{lua|Module:Vertical header}}
{{lua|Module:Vertical header}}
{|{{table|sort|class=floatright}}
{|{{table|sort|class=floatright}}
! {{vert header|stp=1|Regular column}}
! {{Vertical header|stp=1|Regular column}}
! {{vert header|stp=1|Vertical value column}}
! {{Vertical header|stp=1|Vertical value column}}
! {{vert header|stp=1|nb=1|cellstyle=background-color:gold|Thin gold column}}
! {{Vertical header|stp=1|nb=1|cellstyle=background-color:gold|Thin gold column}}
! {{vert header|nb=1|Unsortable column}}
! {{Vertical header|nb=1|Unsortable column}}
|-
|-
| 0 || {{vert header|va=middle|1}} || 1 || 2
| 0 || {{Vertical header|va=middle|1}} || 1 || 2
|-
|-
| 3 || {{vert header|va=middle|5}} || 8 || 13
| 3 || {{Vertical header|va=middle|5}} || 8 || 13
|-
|-
! {{vert header|va=top|Regular column}}
! {{Vertical header|va=top|Regular column}}
! {{vert header|va=top|Vertical value column}}
! {{Vertical header|va=top|Vertical value column}}
! {{vert header|nb=1|va=top|cellstyle=background-color:gold|Thin gold column}}
! {{Vertical header|nb=1|va=top|cellstyle=background-color:gold|Thin gold column}}
! {{vert header|nb=1|va=top|Unsortable column}}
! {{Vertical header|nb=1|va=top|Unsortable column}}
|}
|}
This is a template that helps create vertically-oriented column headers in tables. It even works for [[Help:Sorting|sortable]] columns.
This is a template that helps create vertically-oriented column headers in tables. It even works for [[Help:Sorting|sortable]] columns.
第23行: 第23行:
== Parameter list ==
== Parameter list ==
* <tt>1</tt> — The desired text; can contain wikilinks (<code>[[]]</code>). You can escape the equals sign either by using {{tlx|1==}} or by explicitly mentioning the <code>|1=</code> parameter.
* <tt>1</tt> — The desired text; can contain wikilinks (<code>[[]]</code>). You can escape the equals sign either by using {{tlx|1==}} or by explicitly mentioning the <code>|1=</code> parameter.
* <tt>nb</tt> — Give any non-empty value in order to apply a {{tlx|nobold}} template to the text.
* <tt>nb</tt> — Give any non-empty value in order to apply a nobold template to the text.
* <tt>va</tt> — Vertical alignment (<code>bottom</code>, <code>top</code>, <code>middle</code>). Default is <code>bottom</code>.
* <tt>va</tt> — Vertical alignment (<code>bottom</code>, <code>top</code>, <code>middle</code>). Default is <code>bottom</code>.
* <tt>stp</tt> — Give any non-empty value in order to apply a top padding to the cell (useful if the header is bottom-aligned; '''required for sortable columns''').
* <tt>stp</tt> — Give any non-empty value in order to apply a top padding to the cell (useful if the header is bottom-aligned; '''required for sortable columns''').
第31行: 第31行:


== Examples ==
== Examples ==
* <code><nowiki>! {{vert header|Your text here}}</nowiki></code> — basic example
* <code><nowiki>! {{Vertical header|Your text here}}</nowiki></code> — basic example
* <code><nowiki>! {{vert header|nb=1|stp=1|Your text here}}</nowiki></code> — produces an explicitly sortable, no-bold, sortable header  
* <code><nowiki>! {{Vertical header|nb=1|stp=1|Your text here}}</nowiki></code> — produces an explicitly sortable, no-bold, sortable header  
* <code><nowiki>! {{vert header|va=top|Your text here}}</nowiki></code> — produces an unsortable, top-aligned table header
* <code><nowiki>! {{Vertical header|va=top|Your text here}}</nowiki></code> — produces an unsortable, top-aligned table header
* <code><nowiki>! colspan="2" {{vert header|cellstyle=background-color:gold|Your text here}}</nowiki></code> — produces an unsortable header spanning two columns, with a gold background; use no vertical bar after <code>colspan</code>
* <code><nowiki>! colspan="2" {{Vertical header|cellstyle=background-color:gold|Your text here}}</nowiki></code> — produces an unsortable header spanning two columns, with a gold background; use no vertical bar after <code>colspan</code>


You can also use the <code><nowiki>! {{verth|Your text here}}</nowiki></code> shorthand.
You can also use the <code><nowiki>! {{verth|Your text here}}</nowiki></code> shorthand.


An example below (from [[Help:Sorting]]) with headers that span rows or columns (using ''rowspan'' and ''colspan''). '''Note''' that there is no vertical bar <code>|</code> between <code>rowspan=2</code> and <code>{{vert header</code>
An example below (from [[Help:Sorting]]) with headers that span rows or columns (using ''rowspan'' and ''colspan''). '''Note''' that there is no vertical bar <code>|</code> between <code>rowspan=2</code> and <code>{{Vertical header</code>


{|  
{|  
第45行: 第45行:
{| class="wikitable sortable"
{| class="wikitable sortable"
|-
|-
! rowspan=2 {{vert header|stp=1|name}}
! rowspan=2 {{Vertical header|stp=1|name}}
! colspan=2 {{vert header|data columns}}
! colspan=2 {{Vertical header|data columns}}
! rowspan=2 {{vert header|stp=1|another column}}
! rowspan=2 {{Vertical header|stp=1|another column}}
|-
|-
! {{vert header|stp=1|data}}
! {{Vertical header|stp=1|data}}
! {{vert header|stp=1|more data}}
! {{Vertical header|stp=1|more data}}
|-
|-
| cats
| cats
第71行: 第71行:
{| class="wikitable sortable"
{| class="wikitable sortable"
|-
|-
! rowspan=2 {{vert header|stp=1|name}}
! rowspan=2 {{Vertical header|stp=1|name}}
! colspan=2 {{vert header|data columns}}
! colspan=2 {{Vertical header|data columns}}
! rowspan=2 {{vert header|stp=1|another column}}
! rowspan=2 {{Vertical header|stp=1|another column}}
|-
|-
! {{vert header|stp=1|data}}
! {{Vertical header|stp=1|data}}
! {{vert header|stp=1|more data}}
! {{Vertical header|stp=1|more data}}
|-
|-
| cats
| cats

2020年3月2日 (一) 17:38的最新版本

该模板使用Lua

Regular column
Vertical value column
0
1
1 2
3
5
8 13
Regular column
Vertical value column

This is a template that helps create vertically-oriented column headers in tables. It even works for sortable columns.

Although this template was made with table headers in mind, it can work with regular cells as well.

If the header cells have other attributes, for example colspan or rowspan, there must be no vertical bar | between the attributes and the template call.

Parameter list

  • 1 — The desired text; can contain wikilinks ([[]]). You can escape the equals sign either by using {{}} or by explicitly mentioning the |1= parameter.
  • nb — Give any non-empty value in order to apply a nobold template to the text.
  • va — Vertical alignment (bottom, top, middle). Default is bottom.
  • stp — Give any non-empty value in order to apply a top padding to the cell (useful if the header is bottom-aligned; required for sortable columns).
  • mw — Manual width; override the default value, which was automatically generated based on the number of line breaks (you can use <br>, <BR /> or any other combination).
  • style — Additional styles for the <div/> containing the rotated text. May contain double quotes.
  • cellstyle — Additional styles for the entire cell. May contain double quotes. Use this instead of the cell's style attribute. Use background-color instead of background if you need it for the header of a sortable column.

Examples

  • ! {{Vertical header|Your text here}} — basic example
  • ! {{Vertical header|nb=1|stp=1|Your text here}} — produces an explicitly sortable, no-bold, sortable header
  • ! {{Vertical header|va=top|Your text here}} — produces an unsortable, top-aligned table header
  • ! colspan="2" {{Vertical header|cellstyle=background-color:gold|Your text here}} — produces an unsortable header spanning two columns, with a gold background; use no vertical bar after colspan

You can also use the ! {{verth|Your text here}} shorthand.

An example below (from Help:Sorting) with headers that span rows or columns (using rowspan and colspan). Note that there is no vertical bar | between rowspan=2 and {{Vertical header

name
data columns
another column
data
more data
cats 273 53 1
dogs 65 8,492 2
mice 1,649 548 3
{| class="wikitable sortable"
|-
! rowspan=2 {{Vertical header|stp=1|name}}
! colspan=2 {{Vertical header|data columns}}
! rowspan=2 {{Vertical header|stp=1|another column}}
|-
! {{Vertical header|stp=1|data}}
! {{Vertical header|stp=1|more data}}
|-
| cats
| 273
| 53
| 1
|-
| dogs
| 65
| 8,492
| 2
|-
| mice
| 1,649
| 548
| 3
|}

Compatibility

The following browsers have been tested on combinations of Debian 6.0, Mac OS X 10.8, Ubuntu 9.10, Ubuntu 15.04, Windows 7, Windows Server 2008 R2 and Windows 10. The earliest version known to work is highlighted in green. The latest tested configuration that did not work is highlighted in red.

Arora Chrome Dillo Edge Epiphany Firefox Iceape Iceweasel IE Konqueror Luakit Midori Opera Rekonq Safari SeaMonkey
0.11
27 Sep 10
9
4 Feb 11
3.0.4
9 Apr 14
38
2 Aug 16
3.4.2
19 May 12
43
15 Dec 15
2.7.12
19 Jan 13
38.6
11 Feb 16
11
17 Oct 13
4.14
20 Aug 14
039e319
13 Sep 12
0.4.3
6 Nov 14
15
2 Jul 13
1.1
27 Aug 12
9.1
21 Mar 16
2.46
22 Dec 16
Deb 6 Win 7 Ubu 15.04 Win 10 Deb 6 OS X 10.8 Deb 6 Deb 6 Win 10 Ubu 15.04 Ubu 15.04 Ubu 15.04 Win 2008 R2 Ubu 9.10 OS X 10.8 Ubu 15.04
Should theoretically work on the following browsers as well (please confirm):
Android
Browser
Chrome Edge Firefox Safari
3
22 Feb 11
8
2 Dec 10
20
29 Jul 15
41
22 Sep 15
5.1
20 Jul 11
Notes:
  • In Internet Explorer 5–10, the text goes from top to bottom instead of going from bottom to top.
  • Firefox support for vertical text and rotation began in version 25, but it was unstable until version 43, or possibly 41.