Шаблон:Collapse/doc: различия между версиями
м
→Usage: more code cleanup
en>SMcCandlish м (cleanup) |
en>SMcCandlish м (→Usage: more code cleanup) |
||
| Строка 18: | Строка 18: | ||
It is definitely safest to use the named {{para|1}} and {{para|2}} parameters, because otherwise any "=" character will break the template. | It is definitely safest to use the named {{para|1}} and {{para|2}} parameters, because otherwise any "=" character will break the template. | ||
=== The bg parameter === | === The <code>bg</code> parameter === | ||
The bg parameter is optional. It changes the background color. Use [[Web color]] values (e.g. <code>#F0F2F5</code>). | The <code>bg</code> parameter is optional. It changes the background color. Use [[Web color]] values (e.g. <code>#F0F2F5</code>). | ||
;Example: | ;Example: | ||
| Строка 28: | Строка 28: | ||
{{Collapse|1=Discussion text to be put into box.|bg=#F0F2F5}} | {{Collapse|1=Discussion text to be put into box.|bg=#F0F2F5}} | ||
=== The padding parameter === | === The <code>padding</code> parameter === | ||
The padding parameter adjusts the amount of cell padding (defaults to 8px): | The <code>padding</code> parameter adjusts the amount of cell padding (defaults to <code>8px</code>): | ||
{<nowiki />{Collapse|1=<var>Discussion text to be put into box.</var>|padding=20px}<nowiki />} creates the following (expand the box to see the border padding effect): | <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}} | {{Collapse|1=Discussion text to be put into box.|padding=20px}} | ||
| Строка 47: | Строка 47: | ||
<code>{{Tlsp|Collapse|1={{Lorem ipsum}}|2=[[Help:Section|Heading]]}}</code> | <code>{{Tlsp|Collapse|1={{Lorem ipsum}}|2=[[Help:Section|Heading]]}}</code> | ||
===The expand parameter=== | ===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). | 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 clear parameter=== | ===The <code>clear</code> parameter=== | ||
In some situations you may not want the default <code>clear: both;</code> | In some situations you may not want the default <code>clear: both;</code> CSS to apply, with 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=== | ===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 {{tlx|collapse top}} and {{tlx|collapse bottom}} templates instead of {{tlx|collapse}}. | 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. | 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. | ||