模板:Table/doc:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== Usage == <code><nowiki>{{Table|</nowiki>''param1''|''param2''|''param3''|class=<nowiki>}}</nowiki></code> Use at the beginning of a table to assign the <code>wi…”
 
Kangkk​(留言 | 贡献)
无编辑摘要
 
第16行: 第16行:


;Other options
;Other options
*Any other Wikipedia class may be specified using the {{para|class}} parameter.
*Any other Wikipedia class may be specified using the <nowiki>|class</nowiki> parameter.


;
;
Up to three parameters can be used, plus the custom {{para|class}} parameter, and they can be specified in any order.
Up to three parameters can be used, plus the custom <nowiki>|class</nowiki> parameter, and they can be specified in any order.


==Examples==
==Examples==

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

Usage

{{Table|param1|param2|param3|class=}}

Use at the beginning of a table to assign the wikitable and other commonly used table CSS classes. With no parameters, the template outputs class="wikitable" The param1, param2, and param3 parameters can be any of the following options:

Collapse options
  • show, hidable, or collapsible: Uses the collapsible class to show a [hide] link to collapse the table, but leaves the table uncollapsed by default
  • hide, collapse, or collapsed: Uses the collapsible collapsed classes to make the table collapsed with a [show] link to reveal the table.
  • auto or autocollapse: Uses the collapsible autocollapse classes to make the table collapsible, but only collapse it if there are three or more collapsible tables on the page
  • inner or innercollapse: Uses the collapsible innercollapse classes to make the table collapsible, but only collapse if the table is within a larger table with the outercollapse class.
  • outer or outercollapse: Uses the outercollapse class to collapse any smaller tables within the table it that use the innercollapse class. Can be combined with the various collapse and sort options above.
Sort options
  • sort or sortable: Uses the sortable class to add sorting buttons to each column of the table. Can be combined with the various collapse options above or with outercollapse.
Other options
  • Any other Wikipedia class may be specified using the |class parameter.

Up to three parameters can be used, plus the custom |class parameter, and they can be specified in any order.

Examples

With no parameters
{| {{Table}}
! Rows !! Data
|-
! Row 1
| Datum1
|-
! Row 2
| Datum2
|}

Uses class="wikitable" to produce

Rows Data
Row 1 Datum1
Row 2 Datum2
With parameters
{| {{Table|hide|sort}}
! Rows !! Data
|-
! Row 1
| Datum1
|-
! Row 2
| Datum2
|}

Uses class="wikitable collapsible collapsed sortable" to produce

With custom parameters
{| {{Table|sort|class=floatright}}
! Rows !! Data
|-
! Row 1
| Datum1
|-
! Row 2
| Datum2
|}

Uses class="wikitable sortable floatright" to produce:

Rows Data
Row 1 Datum1
Row 2 Datum2