Simple example:
{{User:Zigger/autosection| Hello world }} Hi! {{User:Zigger/autosection}}
Parameters
|
---|
- title
- The title of the section. The default value is "Missing section title parameter (more...)". This parameter name can be omitted if the title is supplied as the first parameter. (If the title value starts with an "
= " character (e.g. "title==Hello world= "), this will be treated by mediawiki as increasing the "depth". assuming that there is a matching ending "=" character.) This parameter can also be named as 1. e.g. {{User:Zigger/autosection| depth=2 |1 = Hello world }}
- depth
- Section indentation depth, i.e. HTML heading level less two. The default value is 0. Values other than -1, 0, 1, 2 or 3 will result in a value of 4. Outer sections can use the default or specify 0. The next inner section level must specify 1, and so on. The resulting HTML header level will be a number two greater than depth. (A value of -1, resulting in HTML heading level 1, is reserved by mediawiki for the page title, and should be avoided.) Section embedding is not controlled by depth, but can be easily done by placement of the start and end templates (see the full examples).
- state
- Whether the section is shown initially. The default is that it is shown, which also ensures that printing & other non-interactive renderings of the initial view are complete (strongly recommended for pages in the article namespace, despite the popularity of "spoilers"). Use "
state=collapsed " if you want the section to be hidden initially. Using "state=autocollapse " initially collapses the autosection only if there are two or more autosections (or collapsible tables such as navboxes) on the same page. Other values can produce various results (as state is used in the class list for the "section table").
- anchorN
- In addition to the anchor for the section title, which is always set automatically, this parameter allows additional anchors to be set, e.g.
{{User:Zigger/autosection| Hello world | anchor1 = Hello | anchor2 = World }}
- Test autosection anchors on this page: title=Limitations (due to the template design), anchor1=Limitations.
See also: Template:Anchor.
- width
- The minimum percentage width of the section (within the parent container). The default is "
100 ". A useful value for a messagebox-type size is "80 ". Using "width=50 " is equivalent to using "style=width:50% ", but width is more convenient. Use style to set width in other units, e.g. "style=width:50em ", or to use the "min-width: " and "max-width " variations. Please note that the width is more of a guideline than an absolute, with browsers expected to follow various CSS computations.
- color
- The background color, which is a CSS parameter. The default is inherited from the "parent container". Examples of valid CSS values are "
blue ", "rgb(50%,50%,50%) " and "#aaa; ". Using "color=red " is equivalent to using "style=background-color:red ", but color is more convenient.
- style
- Any extra CSS style setting or combination thereof. Please note that "
style=color:green " sets the default text color of the section, whereas "color=green " is equivalent to "style=background-color:green " and sets the background color. Tip: in CSS, multiple attribute:value tuples are separated by ";", e.g. "style=margin-top:3em;font-family:Cursive ".
- heir
- This allows the autosection to inherit the particular group of style settings (
border , margin , padding ) which are otherwise reset to standard values by default. Use "heir=1 " to instead inherit these particular style settings from the parent container. Please note that all other style settings are inherited regardless, except for those explicitly overriden via the color and style parameters.
Parameter examples
|
---|
{{User:Zigger/autosection}}| External links }}
{{User:Zigger/autosection| External links | state = collapsed | style = color:green }}
{{User:Zigger/autosection| Sub-types |depth=1}}
{{User:Zigger/autosection| Detail |color=blue}}
{{User:Zigger/autosection| Section title |depth=2|color=rgb(75%,75%,0%)}}
Please note that the autosection must be terminated by using the same template, but without any parameters. Full examples are in the next sections.
|
|
|