|
|
Line 1: |
Line 1: |
| | <noinclude>{{Protected template}}</noinclude> |
| {| <!-- Template:Collapse --> class="mw-collapsible {{#switch:{{lc:{{{expand|no}}}}}|uncollapse|uncollapsed|expand|expanded|yes|y=mw-uncollapsed|#default=mw-collapsed}} {{{class|}}}" style="{{{{{|safesubst:}}}#ifeq:{{NAMESPACEE}}|{{ns:0}}|display: none;}}background-color: #4B4951 |; text-align: left; border: {{{border|1px}}} solid {{{b-color|silver}}}; {{{{{|safesubst:}}}#switch:{{{float|}}} | | {| <!-- Template:Collapse --> class="mw-collapsible {{#switch:{{lc:{{{expand|no}}}}}|uncollapse|uncollapsed|expand|expanded|yes|y=mw-uncollapsed|#default=mw-collapsed}} {{{class|}}}" style="{{{{{|safesubst:}}}#ifeq:{{NAMESPACEE}}|{{ns:0}}|display: none;}}background-color: #4B4951 |; text-align: left; border: {{{border|1px}}} solid {{{b-color|silver}}}; {{{{{|safesubst:}}}#switch:{{{float|}}} |
| | left = margin:0.2em 0.5em 0.2em 0; width:{{{{{|safesubst:}}}#if:{{{width|}}}|{{{width}}}|auto}}; float: left; clear: {{{clear|left}}} | | | left = margin:0.2em 0.5em 0.2em 0; width:{{{{{|safesubst:}}}#if:{{{width|}}}|{{{width}}}|auto}}; float: left; clear: {{{clear|left}}} |
Line 13: |
Line 14: |
| |}{{{{{|safesubst:}}}#ifeq:{{NAMESPACEE}}|{{ns:0}}|<span class="error noprint">[[Template:collapse]] is not available for use in articles (see [[MOS:COLLAPSE]]).</span>}}<noinclude> | | |}{{{{{|safesubst:}}}#ifeq:{{NAMESPACEE}}|{{ns:0}}|<span class="error noprint">[[Template:collapse]] is not available for use in articles (see [[MOS:COLLAPSE]]).</span>}}<noinclude> |
| </noinclude> | | </noinclude> |
| | <noinclude> |
| | == Usage == |
| | === <code>bg</code> parameter === |
| | |
| | The <code>bg</code> parameter is optional parameter that allows the user to change the background color. optional. It changes the background color. Use [[Web color]] values (e.g. <code>#F0F2F5</code>). |
| | |
| | ;Example: |
| | |
| | <code>{<nowiki />{Collapse|1=<var>Discussion text to be put into box.</var>|bg=#F0F2F5}<nowiki />}</code> creates: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|bg=#F0F2F5}} |
| | |
| | === The <code>padding</code> parameter === |
| | The <code>padding</code> parameter adjusts the amount of cell padding (defaults to <code>8px</code>): |
| | |
| | <code>{<nowiki />{Collapse|1=<var>Discussion text to be put into box.</var>|padding=20px}<nowiki />}</code> creates the following (expand the box to see the border padding effect): |
| | |
| | {{Collapse|1=Discussion text to be put into box.|padding=20px}} |
| | |
| | === The <code>float</code> parameter === |
| | The <code>float</code> parameter allows the collapsed content to float to the left, right, or center of the page (defaults to <code>none</code> with <code>width = 100%</code>): |
| | |
| | <code><nowiki>{{</nowiki>Collapse|1=<var>Discussion text to be put into box.</var>|float=center<nowiki>}}</nowiki></code> creates the following: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|float=center}} |
| | |
| | <code><nowiki>{{</nowiki>Collapse|1=<var>Discussion text to be put into box.</var>|float=center|width=30em<nowiki>}}</nowiki></code> creates the following: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|float=center|width=30em}} |
| | |
| | <code><nowiki>{{</nowiki>Collapse|1=<var>Discussion text to be put into box.</var>|float=left|width=30em<nowiki>}}</nowiki></code> creates the following: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|float=left|width=30em}} |
| | {{clear}} |
| | <code><nowiki>{{</nowiki>Collapse|1=<var>Discussion text to be put into box.</var>|float=right|width=30em<nowiki>}}</nowiki></code> creates the following: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|float=right|width=30em}} |
| | {{clear}} |
| | <code><nowiki>{{</nowiki>Collapse|1=<var>Discussion text to be put into box.</var>|float=none|width=30em<nowiki>}}</nowiki></code> creates the following: |
| | |
| | {{Collapse|1=Discussion text to be put into box.|float=none|width=30em}} |
| | |
| | ===The <code>expand</code> parameter=== |
| | Simply add {{para|expand|yes}} to have the box show up in expanded form with a "hide" link, instead of collapsed form with a "show" link. Other options: {{para|expand|}} <code>yes, y, expand, expanded, uncollapse, uncollapsed</code>. Note: {{para|expand|no}} will fold the box (default). |
| | |
| | ===The <code>clear</code> parameter=== |
| | 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 {{para|clear|none}}, {{para|clear|right}}, or {{para|clear|left}}, as needed. |
| | |
| | ===When content includes tables=== |
| | This template frequently breaks when used around content that consists of or includes [[Help:Table|wikitables]]. Such content can be made collapsible by using the {{tlx|collapse top}} and {{tlx|collapse bottom}} templates instead of {{tlx|collapse}}. |
| | |
| | If you want to collapse only the table and not other content, you can do this using wikitable parameters. See the [[Help:Collapsing#Collapsing tables by default|Collapsing tables]] guide for help. |
|
This high-risk template has been protected from editing to prevent vandalism.
Please discuss changes on the talk page. You may use editprotected on the talk page to ask for an administrator to make an edit for you.
|
Usage
bg
parameter
The bg
parameter is optional parameter that allows the user to change the background color. optional. It changes the background color. Use Web color values (e.g. #F0F2F5
).
- Example
{{Collapse|1=Discussion text to be put into box.|bg=#F0F2F5}}
creates:
Extended content
|
Discussion text to be put into box.
|
The padding
parameter
The padding
parameter adjusts the amount of cell padding (defaults to 8px
):
{{Collapse|1=Discussion text to be put into box.|padding=20px}}
creates the following (expand the box to see the border padding effect):
Extended content
|
Discussion text to be put into box.
|
The float
parameter
The float
parameter allows the collapsed content to float to the left, right, or center of the page (defaults to none
with width = 100%
):
{{Collapse|1=Discussion text to be put into box.|float=center}}
creates the following:
Extended content
|
Discussion text to be put into box.
|
{{Collapse|1=Discussion text to be put into box.|float=center|width=30em}}
creates the following:
Extended content
|
Discussion text to be put into box.
|
{{Collapse|1=Discussion text to be put into box.|float=left|width=30em}}
creates the following:
Extended content
|
Discussion text to be put into box.
|
{{Collapse|1=Discussion text to be put into box.|float=right|width=30em}}
creates the following:
Extended content
|
Discussion text to be put into box.
|
{{Collapse|1=Discussion text to be put into box.|float=none|width=30em}}
creates the following:
Extended content
|
Discussion text to be put into box.
|
The expand
parameter
Simply add Template:Para to have the box show up in expanded form with a "hide" link, instead of collapsed form with a "show" link. Other options: Template:Para yes, y, expand, expanded, uncollapse, uncollapsed
. Note: Template:Para will fold the box (default).
The clear
parameter
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 Template:Para, Template:Para, or Template:Para, as needed.
When content includes tables
This template frequently breaks when used around content that consists of or includes wikitables. Such content can be made collapsible by using the Template:Tlx and Template:Tlx templates instead of Template:Tlx.
If you want to collapse only the table and not other content, you can do this using wikitable parameters. See the Collapsing tables guide for help.