Template:Collapse top

From Dream Cancel Wiki
Revision as of 13:19, 14 February 2022 by Franck Frost (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Extended content

Collapse template.

Template DocumentationEdit This Documentation
The {{collapse top}} template (or {{cot}}), and its paired template {{collapse bottom}} (or {{cob}}), are used for placing a collapse box around content.

Usage

Place {{collapse top}} (or {{cot}}), and {{collapse bottom}} (or {{cob}}), around the text to be collapsed. For example:

{{collapse top|title=This is the title text}}
Collapse Template
{{collapse bottom}}

produces:

This is the title text

Collapse Template

{{collapse bottom}} should always be placed on its own line.


Parameters

This template takes the following parameters, all of which are optional. They are case-sensitive.

| 1 =, | title =, | reason =, | header =, | heading =, | result =, or first unnamed parameter

Will give the collapsed box a title, which occurs on the same line as the show link and is always visible. It defaults to "Extended content". For example, {{collapse top|title=This is the title text}} or {{collapse top|This is the title text}}. Note: The shorter, unnamed markup will not work if the title value contain an equals (=) character.

| 2 = or second unnamed parameter

This is an optional warning-line text.

| left = yes

Will align the title along the left margin. By default, text is centered, specifically between the left edge of the green box and the left edge of the "show" link. Any value will enable this parameter (i.e. | left = no will not work as expected); nor is there a | right = parameter.

| expand = yes or | collapse = no

Will leave the material uncollapsed with the border and coloring. Default is to collapse the material. Any value will have this effect (i.e. | expand = no and | collapse = yes will not work as expected).

| bg =

Sets the background color of the collapsed material. Defaults to #F0F2F5, a light grey. Named colors are listed here. For example, {{collapse top|This is the title text|bg=#32CD32}} or {{collapse top|This is the title text|bg=LimeGreen}} (HTML color codes require the leading #).

| fc =

Sets the font color of the title of the collapsible bar. Defaults to inheriting the current text color of the context. See | bg = above for details on color options.

| border =

Sets the width of the border line on the collapsed material. defaults to 1px. For example, {{collapse top|border=2px}}; going much thicker than this is not very useful.

| b-color =

Sets the border color. defaults to Silver (#C0C0C0). See | bg = above for details on color options.

| padding =

Sets the padding (distance from borders) on the collapsed material inside the colored area. Defaults to 0.6em.

| width =

Sets the width of the overall template relative to the page (or a block element containing the collapse box). This should virtually always be given as a percentage, e.g. | width = 50%, or in relative em units, e.g. | width = 30em. Pixel-based values should be avoided, as they are effectively meaningless – the result will be different depending on each user's browser and local CSS settings (which browser and operating system it is, zoom level, font sizes, etc.).

| border2 =

Sets the properties of the border of the box that appears when template is expanded; defaults to 1px Silver (there is no provision to change from a solid line). For example, {{collapse top|border2=2px}} (only width or color will be changed if only one value is supplied). See | bg = above for details on color options.

| bg2 =

Sets the background color of the box that appears when template is expanded; defaults to White (#FFFFFF). See | bg = above for details on color options.

| indent =

Indents the box from the left of the page. Defaults to no indentation. Each : in talk page markup is approximately equivalent to 1.6em of indent (e.g., to match :::: indentation level, use | indent = 6.4em). You can also use a percentage value. Pixel-based values should be avoided (see | width = above for why).

| clear =

In some situations you may not want the default clear: both; CSS to apply, which puts the collapse box below any left- or right-floated content within the same HTML block. In this case, you can use | clear = none, | clear = right, or | clear = left, as needed.


Examples

  • Adding a box title (if omitted, default is 'Extended content') – {{collapse top|This is the title text}}
This is the title text

Collapse Template

  • Adding a custom warning line – {{collapse top|This is the title text|This is a custom warning line}}
This is the title text
This is a custom warning line

Collapse Template

  • Aligning box title along left margin – {{collapse top|left=yes}}
Extended content

Collapse Template

  • Changing background color – {{collapse top|bg=#32CD32}} or {{collapse top|bg=LimeGreen}}
Extended content

Collapse Template

  • Adding extra padding – {{collapse top|padding=5em}}
Extended content

Collapse Template


This documentation is automatically transcluded from Template:Collapse top/Documentation and is not included when this page is transcluded.