Template:Collapse/doc: Difference between revisions
m + align parameter |
W like wiki (talk | contribs) oops |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> |
|||
{{Documentation subpage}} |
|||
{{Uses TemplateStyles|Template:Collapse/styles.css}} |
|||
==='''{{int:usage}}'''=== |
|||
{{TemplateBox |
|||
|1 = title |
|||
|1label-en= title |
|||
|1d-en = The always visible title of the collapsed box |
|||
|1aliases = <!-- List of aliases, separated by / (a slash) --> |
|||
|1type = line |
|||
|1def = <nowiki>{{PAGENAME}}</nowiki> |
|||
|1stat = suggested |
|||
|2 = 1 |
|||
<code><nowiki>{{</nowiki>collapse|title=''title''|1=''content''}}</code> |
|||
|2label-en= content |
|||
|2d-en = Hidden content of the box. If it includes an equal sign, be sure to use the <code><nowiki>{{collapsed|1=</nowiki>''content''<nowiki>}}</nowiki></code> form or replace the equal signs with <code>&#61;</code>. |
|||
|2d-td-en = Hidden content of the box. If it includes an equal sign, be sure to use the “<nowiki>{{collapsed|1=</nowiki>''content''<nowiki>}}</nowiki>” form or replace the equal signs with “&#61;”. |
|||
|2aliases = |
|||
|2type = content |
|||
|2def = |
|||
|2stat = required |
|||
|3 = expand |
|||
* Note: If the ''content'' includes an equal sign, use <code><nowiki>{{</nowiki>collapsed|1=''content''}}</code> or replace the equal signs with <code>&#61;</code>. |
|||
|3label-en= expand |
|||
* Set <code>expand</code> to 'yes' (or anything besides 'no') to have the box expanded by default. |
|||
|3d-en = Whether the box should be expanded (not collapsed) by default (anything apart from “no” means yes) |
|||
* Default title is <nowiki>{{PAGENAME}}</nowiki> unless defined otherwise by title= ''MyTitle'' |
|||
|3aliases = |
|||
===Optional parameters=== |
|||
|3type = line |
|||
* <code>header-c</code> = header color {{color|grey|(default: #f0f2f5)}} |
|||
|3def = no |
|||
* <code>border-c</code> = border color {{color|grey|(default: #c0c0c0)}} |
|||
|3stat = optional- |
|||
* <code>background-c</code> = background color {{color|grey|(default: #fff)}} |
|||
* <code>border-w</code> = border width {{color|grey|(default: 1px)}} |
|||
|4 = header-c |
|||
* <code>border-s</code> = border style {{color|grey|(default: solid)}} |
|||
|4label-en= header background color |
|||
* <code>font-size</code> = size of header and body text {{color|grey|(default: 88%)}} |
|||
|4d-en = CSS color code or name of the background color of the header |
|||
* <code>header-fs</code> = size of header text {{color|grey|(default: 88% or '<tt>font-size</tt>' if set)}} |
|||
|4aliases = |
|||
* <code>header-fc</code> = color of header text {{color|grey|(default: #000000)}} |
|||
|4type = line |
|||
* <code>width</code> = width of box {{color|grey|(default: 100%)}} |
|||
|4def = #f0f2f5 |
|||
* <code>align</code> = align of box {{color|grey|(default: center)}} |
|||
|4stat = optional- |
|||
View source for additional parameters. |
|||
<!-- |
|||
|5 = border-c |
|||
The title is shifted slightly to the left due to the show/hide button. This can be corrected by declaring '<tt>header-align</tt>' equal to '<tt>center</tt>' (even though that's already the default). |
|||
|5label-en= border color |
|||
--> |
|||
|5d-en = CSS color code or name of the outer border of the whole box |
|||
<includeonly> |
|||
|5aliases = |
|||
[[Category:Formatting templates|{{PAGENAME}}]] |
|||
|5type = line |
|||
[[Category:Collapsible templates|{{PAGENAME}}]] |
|||
|5def = #aaa |
|||
</includeonly> |
|||
|5stat = optional- |
|||
|6 = background-c |
|||
|6label-en= background color |
|||
|6d-en = CSS color code or name of the background of the whole box |
|||
|6aliases = |
|||
|6type = line |
|||
|6def = #fff |
|||
|6stat = optional- |
|||
|7 = border-w |
|||
|7label-en= border width |
|||
|7d-en = CSS length of the width of the outer border of the whole box |
|||
|7aliases = |
|||
|7type = line |
|||
|7def = 1px |
|||
|7stat = optional- |
|||
|8 = border-s |
|||
|8label-en= border style |
|||
|8d-en = CSS border style of the outer border of the whole box |
|||
|8aliases = |
|||
|8type = line |
|||
|8def = solid |
|||
|8stat = optional- |
|||
|9 = font-size |
|||
|9label-en= general font size |
|||
|9d-en = CSS font size of the header and body text (relative values are relative to the context of the box) |
|||
|9aliases = |
|||
|9type = line |
|||
|9def = 88% |
|||
|9stat = optional- |
|||
|10 = header-fs |
|||
|10label-en= header font size |
|||
|10d-en = CSS font size of the header text; overrides the general font size (relative values are still relative to the context of the box, not the general font size) |
|||
|10aliases = |
|||
|10type = line |
|||
|10def = |
|||
|10stat = optional- |
|||
|11 = header-fc |
|||
|11label-en= header foreground color |
|||
|11d-en = CSS color code or name of the foreground (text) color of the header |
|||
|11aliases = |
|||
|11type = line |
|||
|11def = #000 |
|||
|11stat = optional- |
|||
|12 = width |
|||
|12label-en= width |
|||
|12d-en = CSS length of the width of the box |
|||
|12aliases = |
|||
|12type = line |
|||
|12def = 100% |
|||
|12stat = optional- |
|||
|13 = align |
|||
|13label-en= body text align |
|||
|13d-en = Text alignment of the content: “left”, “right” or “center”. By default it inherits the context’s alignment |
|||
|13aliases = |
|||
|13type = line |
|||
|13def = |
|||
|13stat = optional- |
|||
|14 = header-align |
|||
|14label-en= header text align |
|||
|14d-en = Text alignment of the header: “left”, “right” or “center”. Explicit “center” enlarges left padding of the title <!-- The title is shifted slightly to the left due to the show/hide button. This can be corrected by declaring '<code>header-align</code>' equal to '<code>center</code>' (even though that's already the default). --> |
|||
|14aliases = |
|||
|14type = line |
|||
|14def = center |
|||
|14stat = optional- |
|||
|15 = clear |
|||
|15label-en= clear |
|||
|15d-en = The side to clear on (i.e. prevent things floated to that side of the page from overlapping with the collapse box): “left”, “right”, “both” or “none” |
|||
|15aliases = |
|||
|15type = line |
|||
|15def = both |
|||
|15stat = optional- |
|||
|16 = margin |
|||
|16label-en= margin |
|||
|16d-en = CSS margin size of the whole box |
|||
|16aliases = |
|||
|16type = line |
|||
|16def = auto |
|||
|16stat = optional- |
|||
|17 = color |
|||
|17label-en= body foreground color |
|||
|17d-en = CSS color code or name of the foreground (text) color of the body |
|||
|17aliases = |
|||
|17type = line |
|||
|17def = #222 |
|||
|17stat = optional- |
|||
|18 = class |
|||
|18label-en= CSS class |
|||
|18d-en = Additional CSS classes for the whole box |
|||
|18aliases = |
|||
|18type = line |
|||
|18def = |
|||
|18stat = optional- |
|||
| name = collapse |
|||
| desc-en = This template creates a collapsible box. |
|||
| namespace = all |
|||
| usergroup = all |
|||
| setscats = |
|||
* [[:Category:Pages using "Collapse" template without content]], if parameter <code>1</code> is empty. |
|||
| seealso = |
|||
* {{tld|collapse top}} |
|||
* {{tld|collapse bottom}} |
|||
| i18n-method = - |
|||
| useTemplateData = 1 |
|||
}} |
|||
<includeonly>{{Sandbox other|| |
|||
<!-- Categories below this line; interwikis at Wikidata --> |
|||
[[Category:Formatting templates]] |
|||
[[Category:Collapsible templates]] |
|||
}}</includeonly> |
Latest revision as of 19:15, 4 February 2024
This template uses TemplateStyles: |
This template creates a collapsible box.
The template automatically sets the following categories:
- Category:Pages using "Collapse" template without content, if parameter
1
is empty.
Usage
{{collapse |title= |1= }}
Template parameters
Parameter | Description | Default | Status | |
---|---|---|---|---|
title | title | The always visible title of the collapsed box | {{PAGENAME}} | suggested |
1 | content | Hidden content of the box. If it includes an equal sign, be sure to use the {{collapsed|1=content}} form or replace the equal signs with = . | empty | required |
expand | expand | Whether the box should be expanded (not collapsed) by default (anything apart from “no” means yes) | no | optional |
header-c | header background color | CSS color code or name of the background color of the header | #f0f2f5 | optional |
border-c | border color | CSS color code or name of the outer border of the whole box | #aaa | optional |
background-c | background color | CSS color code or name of the background of the whole box | #fff | optional |
border-w | border width | CSS length of the width of the outer border of the whole box | 1px | optional |
border-s | border style | CSS border style of the outer border of the whole box | solid | optional |
font-size | general font size | CSS font size of the header and body text (relative values are relative to the context of the box) | 88% | optional |
header-fs | header font size | CSS font size of the header text; overrides the general font size (relative values are still relative to the context of the box, not the general font size) | empty | optional |
header-fc | header foreground color | CSS color code or name of the foreground (text) color of the header | #000 | optional |
width | width | CSS length of the width of the box | 100% | optional |
align | body text align | Text alignment of the content: “left”, “right” or “center”. By default it inherits the context’s alignment | empty | optional |
header-align | header text align | Text alignment of the header: “left”, “right” or “center”. Explicit “center” enlarges left padding of the title | center | optional |
clear | clear | The side to clear on (i.e. prevent things floated to that side of the page from overlapping with the collapse box): “left”, “right”, “both” or “none” | both | optional |
margin | margin | CSS margin size of the whole box | auto | optional |
color | body foreground color | CSS color code or name of the foreground (text) color of the body | #222 | optional |
class | CSS class | Additional CSS classes for the whole box | empty | optional |
Template data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard. Existing template documentation Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information This template creates a collapsible box.
|
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
See also
- {{collapse top}}
- {{collapse bottom}}
Localization
This template is not intended to be localized.