-The Dream Cancel Wiki has successfully upgraded it's wiki software and editing has returned. Tables for data have returned.
Template:Collapse top/Documentation: Difference between revisions
Franck Frost (talk | contribs) No edit summary |
Franck Frost (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The {{tlx|collapse top}} template (or {{tlx|cot}}), and its paired template {{tlx|collapse bottom}} (or {{tlx|cob}}), are used for placing a collapse box around content. | |||
== Usage == | == Usage == | ||
Place {{tlx|collapse top}} (or {{tlx|cot}}), and {{tlx|collapse bottom}} (or {{tlx|cob}}), around the text to be collapsed. For example: | Place {{tlx|collapse top}} (or {{tlx|cot}}), and {{tlx|collapse bottom}} (or {{tlx|cob}}), around the text to be collapsed. For example: | ||
Line 17: | Line 18: | ||
This template takes the following parameters, all of which are optional. They are case-sensitive. | This template takes the following parameters, all of which are optional. They are case-sensitive. | ||
{{DocParam| 1}}, {{DocParam| title}}, {{DocParam| reason}}, {{DocParam| header}}, {{DocParam| heading}}, {{DocParam| result}}<span style="font-weight: normal;">, or first unnamed parameter</span> | |||
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, <code><nowiki>{{collapse top|title=This is the title text}}</nowiki></code> or <code><nowiki>{{collapse top|This is the title text}}</nowiki></code>. Note: The shorter, unnamed markup will not work if the title value contain an equals (<code>=</code>) character. | : 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, <code><nowiki>{{collapse top|title=This is the title text}}</nowiki></code> or <code><nowiki>{{collapse top|This is the title text}}</nowiki></code>. Note: The shorter, unnamed markup will not work if the title value contain an equals (<code>=</code>) character. | ||
{{DocParam| 2}} <span style="font-weight: normal;"> or second unnamed parameter</span> | |||
: This is an optional warning-line text. | : This is an optional warning-line text. | ||
{{DocParam| 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. {{DocParam| left | no}} will not work as expected); nor is there a {{DocParam| right}} parameter.}} | |||
{{DocParam| expand | yes}} <span style="font-weight: normal;">or</span> {{DocParam| 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. {{DocParam| expand | no}} and {{DocParam| collapse | yes}} will not work as expected).}} | |||
{{DocParam| bg || Sets the background color of the collapsed material. Defaults to <code>#F0F2F5</code>, a light grey. Named colors are listed [https://en.wikipedia.org/wiki/Lists_of_colors here]. For example, <code><nowiki>{{collapse top|This is the title text|bg=#32CD32}}</nowiki></code> or <code><nowiki>{{collapse top|This is the title text|bg=LimeGreen}}</nowiki></code> (HTML color codes require the leading <code>#</code>).}} | |||
{{DocParam| fc || Sets the font color of the title of the collapsible bar. Defaults to inheriting the current text color of the context. See {{DocParam| bg}} above for details on color options.}} | |||
{{DocParam| border || Sets the width of the border line on the collapsed material. defaults to <code>1px</code>. For example, <code><nowiki>{{collapse top|border=2px}}</nowiki></code>; going much thicker than this is not very useful.}} | |||
{{DocParam| b-color || Sets the border color. defaults to <code>Silver</code> (<code>#C0C0C0</code>). See {{DocParam| bg}} above for details on color options.}} | |||
{{DocParam| padding || Sets the padding (distance from borders) on the collapsed material inside the colored area. Defaults to <code>0.6em</code>.}} | |||
{{DocParam| 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. {{DocParam| width | 50%}}, or in relative <samp>em</samp> units, e.g. {{DocParam| 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.).}} | |||
{{DocParam| border2 || Sets the properties of the border of the box that appears when template is expanded; defaults to <code>1px Silver</code> (there is no provision to change from a solid line). For example, <code><nowiki>{{collapse top|border2=2px}}</nowiki></code> (only width or color will be changed if only one value is supplied). See {{DocParam| bg}} above for details on color options.}} | |||
{{DocParam| bg2 || Sets the background color of the box that appears when template is expanded; defaults to <code>White</code> (<code>#FFFFFF</code>). See {{DocParam| bg}} above for details on color options.}} | |||
{{DocParam| indent || Indents the box from the left of the page. Defaults to no indentation. Each <code>:</code> in talk page markup is approximately equivalent to <code>1.6em</code> of indent (e.g., to match <code>::::</code> indentation level, use {{DocParam| indent | 6.4em}}). You can also use a percentage value. Pixel-based values should be avoided (see {{DocParam| width}} above for why).}} | |||
{{DocParam| clear || In some situations you may not want the default <code>clear: both;</code> 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 {{DocParam| clear | none}}, {{DocParam| clear | right}}, or {{DocParam| clear | left}}, as needed.}} | |||
Latest revision as of 22:07, 16 February 2022
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 to1.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 |