Changes
Jump to navigation
Jump to search
→Parameters
{{Documentation subpage}}
{{high-use|142550}}
{{Uses TemplateStyles|{{#titleparts:{{FULLPAGENAME}}|1}}/styles.css}}
This template can be used to create simple, flexible coloured text background.
Please note that this is intended to be a decorative template and not for use on the general encyclopedia. It will not display on articles.
== Purpose ==
Wikipedia abounds in boxed templates, such as:
* {{tl|delete}}
* {{tl|tfd}}
* {{tl|GFDL}}
* {{tl|current}}
* {{tl|FAC}}
Boxes may not always be appropriate; they can be obtrusive. But when boxes are used, they are generally formatted ''ad hoc''. This leads to inconsistencies.
{{tl|Divbox}} provides a straightforward method of presenting any text within a box. Colors are selected using a private style keyword, which sets both box border and background, already chosen to work together, in a visual sense.
The keyword <code>none</code> puts your content inside an invisible box. This is available to offer the identical box model for your content, without a visible box.
''This'' template may be used within another template; or as part of another page.
== Usage==
Template general syntax is as follows:
<pre>
{{divbox|1=style|2=title|3=content|radius=}}
</pre>
===Parameters===
;1 (Style)
:Mandatory. Use any of the following (or any others in [[Template:Divbox/styles.css|styles.css]])
:{|
| {{divbox|amber ||amber }}
| {{divbox|black ||black }}
| {{divbox|bloodred ||bloodred }}
| {{divbox|blue ||blue }}
|-
| {{divbox|brown ||brown }}
| {{divbox|forest ||forest }}
| {{divbox|gold ||gold }}
| {{divbox|gray ||gray }}
|-
| {{divbox|green ||green }}
| {{divbox|navy ||navy }}
| {{divbox|none ||none }}
| {{divbox|orange ||orange }}
|-
| {{divbox|plain ||plain }}
| {{divbox|purple ||purple }}
| {{divbox|lilac ||lilac }}
| {{divbox|red ||red }}
|-
| {{divbox|white ||white }}
| {{divbox|yellow ||yellow }}
| {{divbox|fawn ||fawn }}
| {{divbox|tt ||tt }}
|-
| {{divbox|simar ||simar }}
| {{divbox|greenv ||greenv }}
| {{divbox|grayh ||grayh }}
| {{divbox|email ||email }}
|-
| {{divbox|double ||double }}
| {{divbox|wordperfect ||wordperfect }}
| {{divbox|ivory ||ivory }}
| {{divbox|lavender ||lavender }}
|-
| {{divbox|docgreen ||docgreen }}
|}
:You can forgo "1=", as long as this is the first unnamed parameter in the list.
;2 (Title): Optional. Plain text; appears '''strong''' and centered at top. You can forgo "2=", as long as this is the second unnamed parameter in the list.
;3 (Content): Mandatory. Any text, including markup, that is to form the body of the message. You can forgo "3=", as long as this is the third unnamed parameter in the list, and the content does not contain an equals sign (=).
;radius: Radius of the rounded edges, along with a valid unit, such as px, pt or em. The parameter works on styles that innately have both sharp or round edges, overriding their default edge roundness. You can forgo this entire parameter and its value; but if used, you cannot omit "radius=", which is case sensitive. However, like any named parameter, it may appear in any position (i.e. it does not need to be the last parameter).
===Examples===
{|
|-
! scope="col" | What you see
! scope="col" | What you type
|-
| gray:
{{divbox|gray|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|gray|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| red:
{{divbox|radius=5px|red|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=5px|red|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| navy:
{{divbox|radius=10px|navy|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=10px|navy|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| amber:
{{divbox|radius=15px|amber|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=15px|amber|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| Without a border or background:
{{divbox|none|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|none|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| Without title
{{divbox|navy||Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|navy||Lorem ipsum dolor...}}</nowiki></code>
|-
| Content contains '=':
{{divbox|lavender|Lorem ipsum|3=Lorem <span style="color:#F00;">ipsum</span> dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|lavender|Lorem ipsum|3=Lorem <span style="color:#F00;">ipsum</span> dolor...}}</nowiki></code>
|}
== Using subst: with this template ==
The <code>subst:</code> atom may be used with {{tl|divbox}}. ''This may be highly desirable.'' Note that <code>subst:</code> does not take effect in preview, but only after saving a page. The template's inclusion is replaced by the code of the template itself, which will continue to write the box as before, but without an additional server call.
Since {{tl|divbox}} itself calls a template based on your choice of style keyword, you will find that even after saving an instance of use with <code>subst:</code> there remains a "live" call to the underlying style template. This means that viewing the page risks a server call to the style template, ''but'' also means that changes to the style template automatically propagate to all pages where it is used. This way, all {{tl|divbox}}-type boxes, wherever they are in the project, keep the same consistent look.
Just paste in your content and, when you're finished, be sure to close the template call with <code><nowiki>}}</nowiki></code>.
Since the contents are given in the form of two parameter values, for the content you may place within {{tl|divbox}}, the [[m:Help:Template#Restrictions_on_parameter_values|restrictions on parameter values]] apply. For example, if you put content that includes template calls, {{tl|divbox}} cannot tell where its last parameter ends.
If the contents do not satisfy the restrictions, insert this code in your page first:
<code><nowiki>{{subst:divbox|keyword|title|DUMMYCONTENT}}</nowiki></code>
That is, choose your style and title as usual (or omit the title with two pipes), but instead of actual content, write "DUMMYCONTENT". Then, save the page and reopen it for editing. You'll see the box code in all its gory detail, and the placeholder DUMMYCONTENT, followed by the HTML division closing tag. Now, you may simply '''replace''' DUMMYCONTENT with '''your content''', save, and move on. Since almost anything may be placed within division tags, this should not break no matter what you do.
== See also ==
* {{tl|Divhide}}
* {{tl|Box}}
{{Mbox templates see also}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:Box templates|!]]
[[simple:Template:Box]]
[[ru:Шаблон:Divbox]]
}}</includeonly>
{{high-use|142550}}
{{Uses TemplateStyles|{{#titleparts:{{FULLPAGENAME}}|1}}/styles.css}}
This template can be used to create simple, flexible coloured text background.
Please note that this is intended to be a decorative template and not for use on the general encyclopedia. It will not display on articles.
== Purpose ==
Wikipedia abounds in boxed templates, such as:
* {{tl|delete}}
* {{tl|tfd}}
* {{tl|GFDL}}
* {{tl|current}}
* {{tl|FAC}}
Boxes may not always be appropriate; they can be obtrusive. But when boxes are used, they are generally formatted ''ad hoc''. This leads to inconsistencies.
{{tl|Divbox}} provides a straightforward method of presenting any text within a box. Colors are selected using a private style keyword, which sets both box border and background, already chosen to work together, in a visual sense.
The keyword <code>none</code> puts your content inside an invisible box. This is available to offer the identical box model for your content, without a visible box.
''This'' template may be used within another template; or as part of another page.
== Usage==
Template general syntax is as follows:
<pre>
{{divbox|1=style|2=title|3=content|radius=}}
</pre>
===Parameters===
;1 (Style)
:Mandatory. Use any of the following (or any others in [[Template:Divbox/styles.css|styles.css]])
:{|
| {{divbox|amber ||amber }}
| {{divbox|black ||black }}
| {{divbox|bloodred ||bloodred }}
| {{divbox|blue ||blue }}
|-
| {{divbox|brown ||brown }}
| {{divbox|forest ||forest }}
| {{divbox|gold ||gold }}
| {{divbox|gray ||gray }}
|-
| {{divbox|green ||green }}
| {{divbox|navy ||navy }}
| {{divbox|none ||none }}
| {{divbox|orange ||orange }}
|-
| {{divbox|plain ||plain }}
| {{divbox|purple ||purple }}
| {{divbox|lilac ||lilac }}
| {{divbox|red ||red }}
|-
| {{divbox|white ||white }}
| {{divbox|yellow ||yellow }}
| {{divbox|fawn ||fawn }}
| {{divbox|tt ||tt }}
|-
| {{divbox|simar ||simar }}
| {{divbox|greenv ||greenv }}
| {{divbox|grayh ||grayh }}
| {{divbox|email ||email }}
|-
| {{divbox|double ||double }}
| {{divbox|wordperfect ||wordperfect }}
| {{divbox|ivory ||ivory }}
| {{divbox|lavender ||lavender }}
|-
| {{divbox|docgreen ||docgreen }}
|}
:You can forgo "1=", as long as this is the first unnamed parameter in the list.
;2 (Title): Optional. Plain text; appears '''strong''' and centered at top. You can forgo "2=", as long as this is the second unnamed parameter in the list.
;3 (Content): Mandatory. Any text, including markup, that is to form the body of the message. You can forgo "3=", as long as this is the third unnamed parameter in the list, and the content does not contain an equals sign (=).
;radius: Radius of the rounded edges, along with a valid unit, such as px, pt or em. The parameter works on styles that innately have both sharp or round edges, overriding their default edge roundness. You can forgo this entire parameter and its value; but if used, you cannot omit "radius=", which is case sensitive. However, like any named parameter, it may appear in any position (i.e. it does not need to be the last parameter).
===Examples===
{|
|-
! scope="col" | What you see
! scope="col" | What you type
|-
| gray:
{{divbox|gray|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|gray|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| red:
{{divbox|radius=5px|red|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=5px|red|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| navy:
{{divbox|radius=10px|navy|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=10px|navy|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| amber:
{{divbox|radius=15px|amber|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|radius=15px|amber|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| Without a border or background:
{{divbox|none|Lorem ipsum|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|none|Lorem ipsum|Lorem ipsum dolor...}}</nowiki></code>
|-
| Without title
{{divbox|navy||Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|navy||Lorem ipsum dolor...}}</nowiki></code>
|-
| Content contains '=':
{{divbox|lavender|Lorem ipsum|3=Lorem <span style="color:#F00;">ipsum</span> dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}}
|<code><nowiki>{{divbox|lavender|Lorem ipsum|3=Lorem <span style="color:#F00;">ipsum</span> dolor...}}</nowiki></code>
|}
== Using subst: with this template ==
The <code>subst:</code> atom may be used with {{tl|divbox}}. ''This may be highly desirable.'' Note that <code>subst:</code> does not take effect in preview, but only after saving a page. The template's inclusion is replaced by the code of the template itself, which will continue to write the box as before, but without an additional server call.
Since {{tl|divbox}} itself calls a template based on your choice of style keyword, you will find that even after saving an instance of use with <code>subst:</code> there remains a "live" call to the underlying style template. This means that viewing the page risks a server call to the style template, ''but'' also means that changes to the style template automatically propagate to all pages where it is used. This way, all {{tl|divbox}}-type boxes, wherever they are in the project, keep the same consistent look.
Just paste in your content and, when you're finished, be sure to close the template call with <code><nowiki>}}</nowiki></code>.
Since the contents are given in the form of two parameter values, for the content you may place within {{tl|divbox}}, the [[m:Help:Template#Restrictions_on_parameter_values|restrictions on parameter values]] apply. For example, if you put content that includes template calls, {{tl|divbox}} cannot tell where its last parameter ends.
If the contents do not satisfy the restrictions, insert this code in your page first:
<code><nowiki>{{subst:divbox|keyword|title|DUMMYCONTENT}}</nowiki></code>
That is, choose your style and title as usual (or omit the title with two pipes), but instead of actual content, write "DUMMYCONTENT". Then, save the page and reopen it for editing. You'll see the box code in all its gory detail, and the placeholder DUMMYCONTENT, followed by the HTML division closing tag. Now, you may simply '''replace''' DUMMYCONTENT with '''your content''', save, and move on. Since almost anything may be placed within division tags, this should not break no matter what you do.
== See also ==
* {{tl|Divhide}}
* {{tl|Box}}
{{Mbox templates see also}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:Box templates|!]]
[[simple:Template:Box]]
[[ru:Шаблон:Divbox]]
}}</includeonly>