Template:Message/box/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎class: Corr.)
 
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:
==Usage==
==Usage==
{{tl|message/box}} displays a custom made message box, just as {{tl|message}}, but with some added options:
{{tl|message/box}} displays a custom made message box, just as {{tl|message}}, but with some added options:
* message title
* maximum box width
* maximum box width
* image float
* image float
Line 14: Line 15:
__TOC__
__TOC__
==Parameters==
==Parameters==
There are 14 parameters in total, 1 unnamed and 13 named, none of which is rquired for the template to work. Some parameters will affect other parameters or CSS properties if entered, or if set to a specific value. Read the descriptions of the parameters below to learn about these cases.
There are 14 parameters in total, 1 unnamed and 13 named, none of which is required for the template to work. Some parameters will affect other parameters or CSS properties if entered, or if set to a specific value. Read the descriptions of the parameters below to learn about these cases.


;<big>List of parameters</big>
;<big>List of parameters</big>
Line 23: Line 24:
! Element !! Parameter !! Description !! Default value
! Element !! Parameter !! Description !! Default value
|-
|-
| rowspan="5" | Box || <code>class</code> || CSS class amendment || <tt>''null''</tt>
| rowspan="5" | Box || {{code|class}} || CSS class amendment || {{samp|''null''}}
|-
|-
| <code>bgcolor</code> || Background colour || style="background-color: #f6f4ec;" | <tt>#f6f4ec</tt>
| {{code|bgcolor}} || Background colour || style="background-color: #f6f4ec;" | {{samp|#f6f4ec}}
|-
|-
| <code>bdcolor</code> || Border colour || style="background-color: #d7d3c8;" | <tt>#d7d3c8</tt>
| {{code|bdcolor}} || Border colour || style="background-color: #d7d3c8;" | {{samp|#d7d3c8}}
|-
|-
| <code>width</code> || Box width || <tt>none</tt>
| {{code|width}} || Box width || {{samp|none}}
|-
|-
| <code>style</code> || Additional CSS styling || <tt>''null''</tt>
| {{code|style}} || Additional CSS styling || {{samp|''null''}}
|-
|-
| rowspan="5" | Image || <code>image</code> || Image shown in the box || <tt>Idea.png</tt> [[File:Idea.png|25px|alt=|link=]]
| rowspan="5" | Image || {{code|image}} || Image shown in the box || {{samp|Idea.png}} [[File:Idea.png|25px|alt=|link=]]
|-
|-
| <code>imgwidth</code> || Image width || <tt>35</tt> (px)
| {{code|imgwidth}} || Image width || {{samp|35}} (px)
|-
|-
| <code>float</code> || Image float || <tt>left</tt>
| {{code|float}} || Image float || {{samp|left}}
|-
|-
| <code>imgalt</code> || Image alt text || <tt>''image file name''</tt>
| {{code|imgalt}} || Image alt text || {{samp|''image file name''}}
|-
|-
| <code>imglink</code> || Image link || <tt>''empty''</tt>
| {{code|imglink}} || Image link || {{samp|''empty''}}
|-
|-
| rowspan="4" | Text || <code>1</code> ''(unnamed)'' || Message text || <tt>''null''</tt>
| rowspan="5" | Text || {{code|1}} ''(unnamed)'' || Message text || {{samp|''null''}}
|-
|-
| <code>fgcolor</code> || Foreground (text) colour || <tt>black</tt>
| {{code|title}} || Messagebox title (header) || {{samp|''null''}}
|-
|-
| <code>talign</code> || Text alignment || <tt>left</tt>
| {{code|fgcolor}} || Foreground (text) colour || {{samp|black}}
|-
|-
| <code>tdir</code> || Text direction || <tt>ltr</tt>
| {{code|talign}} || Text alignment || {{samp|left}}
|-
| {{code|tdir}} || Text direction || {{samp|ltr}}
|}
|}


Line 55: Line 58:
{| class="wikitable" style="background-color: white;"
{| class="wikitable" style="background-color: white;"
|-
|-
! Size !! Code
! Size !! Template code
|-
|-
| Basic || <code><nowiki>{{message/box|text}}</nowiki></code>
| Basic || {{tlc|message/box|''text''|title{{=}}}}
|-
|-
| Common use || <code><nowiki>{{message/box|text|bgcolor=|bdcolor=|width=|image=|float=}}</nowiki></code>
| Common use || {{tlc|message/box|''text''|title{{=}}|bgcolor{{=}}|bdcolor{{=}}|width{{=}}|image{{=}}|float{{=}}}}}}
|-
|-
| All parameters || <code><nowiki>{{message/box|text|class=|bgcolor=|bdcolor=|width=|style=|image=|imgwidth=|float=|imgalt=|imglink=|fgcolor=|talign=|tdir=}}</nowiki></code>
| All parameters || {{tlc|message/box|''text''|title{{=}}|class{{=}}|bgcolor{{=}}|bdcolor{{=}}|width{{=}}|style{{=}}|image{{=}}|imgwidth{{=}}|float{{=}}|imgalt{{=}}|imglink{{=}}|fgcolor{{=}}|talign{{=}}|tdir{{=}}}}
|}
|}


Line 67: Line 70:
====class====
====class====
;<big>Class</big>
;<big>Class</big>
A custom [[Wikipedia:Cascading Style Sheets|CSS]] class to append to the box's default class <tt>messagebox</tt>.
A custom [[Wikipedia:Cascading Style Sheets|CSS]] class to append to the box's default class {{samp|messagebox}}.


If you, for example, set the value to <tt>german</tt>, the resulting &lt;div&gt; attribute will be <tt>class="messagebox german"</tt>.
If you, for exampl0e, set the value to {{samp|german}}, the resulting {{tag|div|o}} attribute will be {{tag|div|o|params=class="messagebox german"}}.


The default value is <tt>''null''</tt>.
The default value is {{samp|''null''}}.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|class=class name}}</nowiki></code>
* {{tlc|message/box|class{{=}}class name}}


====bgcolor====
====bgcolor====
;<big>Background colour</big>
;<big>Background colour</big>
The background colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. <tt>white</tt>) or a hexadecimal colour code (e.g. <tt>#ffffff</tt> for white).
The background colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. {{samp|white}}) or a hexadecimal colour code (e.g. {{samp|#ffffff}} for white).


The default value is <tt>#f6f4ec</tt>&nbsp; (Mozilla colour "[[Template:Color/Mozilla/sand_start|''sand (gradient start)'']]").
The default value is {{samp|#f6f4ec}}&nbsp; (Mozilla colour "[[Template:Color/Mozilla/sand_start|''sand (gradient start)'']]").


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|bgcolor=colour code/value}}</nowiki></code>
* {{tlc|message/box|bgcolor{{=}}colour code/value}}


;<big>Available values</big>
;<big>Available values</big>
Line 90: Line 93:
! style="width:1.75em;" | !! Value !! Hex !! Comment
! style="width:1.75em;" | !! Value !! Hex !! Comment
|-
|-
| style="background-color: #f6f4ec;" | || <tt>lmozsand</tt> || <tt>#f6f4ec</tt> || '''Default'''
| style="background-color: #f6f4ec;" | || {{samp|lmozsand}} || {{samp|#f6f4ec}} || '''Default'''
|-
|-
| style="background-color: #d7d3c8;" | || <tt>mozsand</tt> || <tt>#d7d3c8</tt> ||
| style="background-color: #d7d3c8;" | || {{samp|mozsand}} || {{samp|#d7d3c8}} ||
|-
|-
| style="background-color: #ea3b28;" | || <tt>lmozred</tt> || <tt>#ea3b28</tt> ||
| style="background-color: #ea3b28;" | || {{samp|lmozred}} || {{samp|#ea3b28}} ||
|-
|-
| style="background-color: #c13832;" | || <tt>mozred</tt> ||<tt>#c13832</tt> ||
| style="background-color: #c13832;" | || {{samp|mozred}} ||{{samp|#c13832}} ||
|-
|-
| style="background-color: #4d4e53;" | || <tt>mozcoal</tt> || <tt>#4d4e53</tt> ||
| style="background-color: #4d4e53;" | || {{samp|mozcoal}} || {{samp|#4d4e53}} ||
|-
|-
| style="text-align: center;" | HEX || Any hex colour value || <tt>#RRGGBB</tt> ||
| style="text-align: center;" | HEX || Any hex colour value || {{samp|#RRGGBB}} ||
|-
|-
| style="text-align: center;" | CSS || Any CSS colour name ||  ||
| style="text-align: center;" | CSS || Any CSS colour name ||  ||
Line 107: Line 110:
====bdcolor====
====bdcolor====
;<big>Border colour</big>
;<big>Border colour</big>
The border colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. <tt>black</tt>) or a hexadecimal colour code (e.g. <tt>#000000</tt> for black).
The border colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. {{samp|black}}) or a hexadecimal colour code (e.g. {{samp|#000000}} for black).


The default value is <tt>#d7d3c8</tt>&nbsp; (Mozilla colour "[[Template:Color/Mozilla/sand|''sand'']]").
The default value is {{samp|#d7d3c8}}&nbsp; (Mozilla colour "[[Template:Color/Mozilla/sand|''sand'']]").


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|bdcolor=colour code/value}}</nowiki></code>
* {{tlc|message/box|bdcolor{{=}}colour code/value}}


;<big>Available values</big>
;<big>Available values</big>
Line 119: Line 122:
! style="width:1.75em;" | !! Value !! Hex !! Comment
! style="width:1.75em;" | !! Value !! Hex !! Comment
|-
|-
| style="background-color: #f6f4ec;" | || <tt>lmozsand</tt> || <tt>#f6f4ec</tt> ||
| style="background-color: #f6f4ec;" | || {{samp|lmozsand}} || {{samp|#f6f4ec}} ||
|-
|-
| style="background-color: #d7d3c8;" | || <tt>mozsand</tt> || <tt>#d7d3c8</tt> || '''Default'''
| style="background-color: #d7d3c8;" | || {{samp|mozsand}} || {{samp|#d7d3c8}} || '''Default'''
|-
|-
| style="background-color: #ea3b28;" | || <tt>lmozred</tt> || <tt>#ea3b28</tt> ||
| style="background-color: #ea3b28;" | || {{samp|lmozred}} || {{samp|#ea3b28}} ||
|-
|-
| style="background-color: #c13832;" | || <tt>mozred</tt> ||<tt>#c13832</tt> ||
| style="background-color: #c13832;" | || {{samp|mozred}} ||{{samp|#c13832}} ||
|-
|-
| style="background-color: #4d4e53;" | || <tt>mozcoal</tt> || <tt>#4d4e53</tt> ||
| style="background-color: #4d4e53;" | || {{samp|mozcoal}} || {{samp|#4d4e53}} ||
|-
|-
| style="text-align: center;" | HEX || Any hex colour value || <tt>#RRGGBB</tt> ||
| style="text-align: center;" | HEX || Any hex colour value || {{samp|#RRGGBB}} ||
|-
|-
| style="text-align: center;" | CSS || Any CSS colour name ||  ||
| style="text-align: center;" | CSS || Any CSS colour name ||  ||
Line 138: Line 141:
You can define the maximum width of the message box in pixels, or as a percentage of the available width.
You can define the maximum width of the message box in pixels, or as a percentage of the available width.


The default value is <tt>none</tt>.
The default value is {{samp|none}}.


;<big>Comment</big>
;<big>Comment</big>
* When defining the message box width, enter the numerical value and the unit (<tt>%</tt> or <tt>px</tt>) as one word, i.e without any spaces, e.g. <tt>60%</tt> or <tt>350px</tt>.
* When defining the message box width, enter the numerical value and the unit ({{samp|%}} or {{samp|px}}) as one word, i.e without any spaces, e.g. {{samp|60%}} or {{samp|350px}}.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|width=numerical value and unit}}</nowiki></code>
* {{tlc|message/box|width{{=}}numerical value and unit}}


====style====
====style====
Line 150: Line 153:
Optional CSS properties with corresponding values. This parameter specifies the style used by the entire message box.
Optional CSS properties with corresponding values. This parameter specifies the style used by the entire message box.


The default value is <tt>''null''</tt>.
The default value is {{samp|''null''}}.


;<big>Comments</big>
;<big>Comments</big>
* Properties have to be enetered without quotation marks (<tt>"…"</tt>) but with the ending semicolon (<tt>;</tt>).
* Properties have to be enetered without quotation marks ({{samp|"…"}}) but with the ending semicolon ({{samp|;}}).
* Don't define properties that already are regulated by other parameters in this template.
* Don't define properties that already are regulated by other parameters in this template.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|style=prop1:value1; prop2:value2;}}</nowiki></code>
* {{tlc|message/box|style{{=}}prop1:value1; prop2:value2;}}


===Image parameters===
===Image parameters===
Line 164: Line 167:
You can choose a custom image to be used in the template, by using the ''image'' parameter. By default, the image is displayed on the left side inside the box, to the left of the text.
You can choose a custom image to be used in the template, by using the ''image'' parameter. By default, the image is displayed on the left side inside the box, to the left of the text.


The default image is <tt>Idea.png</tt> ([[:File:Idea.png]]).
The default image is {{samp|Idea.png}} ([[:File:Idea.png]]).


;<big>Comments</big>
;<big>Comments</big>
* The image must previously have been uploaded to MozillaWiki. See {{category|Icons}} or the MozillaWiki [[Special:ListFiles|file list]].
* The image must previously have been uploaded to MozillaWiki. See {{category|Icons}} or the MozillaWiki [[Special:ListFiles|file list]].
* When defining an image, don't include the namespace (<tt>File:</tt>). That is inserted automatically.
* When defining an image, don't include the namespace ({{samp|File:}}). That is inserted automatically.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|image=name.ext}}</nowiki></code>
* {{tlc|message/box|image{{=}}name.ext}}


====imgwidth====
====imgwidth====
Line 177: Line 180:
The width of the used image (in pixels), defined as a numerical value.
The width of the used image (in pixels), defined as a numerical value.


The default value is <tt>35</tt>.
The default value is {{samp|35}}.


;<big>Comments</big>
;<big>Comments</big>
* When defining the image width, don't include the unit (<tt>px</tt>). That is inserted automatically.
* When defining the image width, don't include the unit ({{samp|px}}). That is inserted automatically.
* The image width affects the margin of the box, allowing it to float without getting covered by text.
* The image width affects the margin of the box, allowing it to float without getting covered by text.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|imgwidth=numerical value}}</nowiki></code>
* {{tlc|message/box|imgwidth{{=}}numerical value}}


====float====
====float====
Line 190: Line 193:
You can change the image's float to floating on the right-hand side, or to no float at all.
You can change the image's float to floating on the right-hand side, or to no float at all.


The default value is <tt>left</tt>.
The default value is {{samp|left}}.


;<big>Comment</big>
;<big>Comment</big>
* Setting the float value to <tt>right</tt> affects the left- and right-hand margins of the box, shifting them to give the image the space it needs on the right (so it doesn't get covered by text), and allowing extra space for the text on the left.
* Setting the float value to {{samp|right}} affects the left- and right-hand margins of the box, shifting them to give the image the space it needs on the right (so it doesn't get covered by text), and allowing extra space for the text on the left.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|float=float value}}</nowiki></code>
* {{tlc|message/box|float{{=}}float value}}


;<big>Available values</big>
;<big>Available values</big>
Line 203: Line 206:
! Value !! style="width:15em;" | Comment
! Value !! style="width:15em;" | Comment
|-
|-
| <tt>left</tt> || <div style="float:left;">[[File:Idea.png|25px|alt=|link=]]</div> <div>'''Default'''</div>
| {{samp|left}} || <div style="float:left;">[[File:Idea.png|25px|alt=|link=]]</div> <div>'''Default'''</div>
|-
|-
| <tt>right</tt> || <div style="float:right;">[[File:Idea.png|25px|alt=|link=]]</div> <div>Image floats to the right</div>
| {{samp|right}} || <div style="float:right;">[[File:Idea.png|25px|alt=|link=]]</div> <div>Image floats to the right</div>
|-
|-
| <tt>none</tt> || <div style="float:none;">[[File:Idea.png|25px|alt=|link=]]</div> <div>No floating, image treated <br>as a separate block</div>
| {{samp|none}} || <div style="float:none;">[[File:Idea.png|25px|alt=|link=]]</div> <div>No floating, image treated <br>as a separate block</div>
|}
|}


====imgalt====
====imgalt====
;<big>Image alt text</big>
;<big>Image alt text</big>
By default, the image's alt text is the same as the image's name, e.g. "<tt>Idea.png</tt>" for the default image. But it is possible to specify a custom alt text using this parameter.
By default, the image's alt text is the same as the image's name, e.g. "{{samp|Idea.png}}" for the default image. But it is possible to specify a custom alt text using this parameter.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|imgalt=custom text}}</nowiki></code>
* {{tlc|message/box|imgalt{{=}}custom text}}


====imglink====
====imglink====
Line 221: Line 224:
By default, the image link is disabled, but it is possible to specify a custom link with this parameter.
By default, the image link is disabled, but it is possible to specify a custom link with this parameter.


The default value is <tt>''null''</tt>.
The default value is {{samp|''null''}}.


;<big>Comments</big>
;<big>Comments</big>
* When entering an internal wikilink, don't include the brackets (<tt><nowiki>[[…]]</nowiki></tt>). Example: <tt>L10n:Home Page</tt>
* When entering an internal wikilink, don't include the brackets ({{samp|<nowiki>[[…]]</nowiki>}}). Example: {{samp|L10n:Home Page}}
* When entering an URL, include the protocol (<tt>http://</tt>, <tt>https://</tt>, etc.). Example: <tt><nowiki>https://www.mozilla.org/sv-SE/</nowiki></tt>
* When entering an URL, include the protocol ({{samp|http://}}, {{samp|https://}}, etc.). Example: {{samp|<nowiki>https://www.mozilla.org/sv-SE/</nowiki>}}


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|imglink=wikilink/URL}}</nowiki></code>
* {{tlc|message/box|imglink{{=}}wikilink/URL}}


===Text parameters===
===Text parameters===
Line 235: Line 238:
Custom text string, wiki-formatting can be used. The parameter is unnamed, so no parameter name needs to be entered.
Custom text string, wiki-formatting can be used. The parameter is unnamed, so no parameter name needs to be entered.


The default value is <tt>''null''</tt>, but without defining this parameter, i.e. including a message, the template is more or less useless as a message box.
The default value is {{samp|''null''}}, but without defining this parameter, i.e. including a message, the template is more or less useless as a message box.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|custom text}}</nowiki></code>
* {{tlc|message/box|custom text}}
 
====title====
;<big>Message title</big>
Custom text string, output in bold and larger text-size. The message text will be displayed one line beneath the title.
 
The default value is {{samp|''null''}}.
 
;<big>Usage</big>
* {{tlc|message/box|title{{=}}custom text}}


====fgcolor====
====fgcolor====
;<big>Foreground colour</big>
;<big>Foreground colour</big>
The foreground colour of the box (i.e. text colour), defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. <tt>black</tt>) or a hexadecimal colour code (e.g. <tt>#000000</tt> for black).
The foreground colour of the box (i.e. text colour), defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. {{samp|black}}) or a hexadecimal colour code (e.g. {{samp|#000000}} for black).


The default colour is <tt>black</tt> (i.e the CSS name value).
The default colour is {{samp|black}} (i.e the CSS name value).


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|fgcolor=colour code/value}}</nowiki></code>
* {{tlc|message/box|fgcolor{{=}}colour code/value}}


;<big>Available values</big>
;<big>Available values</big>
Line 254: Line 266:
! style="width:1.75em;" | !! Value !! Hex
! style="width:1.75em;" | !! Value !! Hex
|-
|-
| style="background-color: #f6f4ec;" | || <tt>lmozsand</tt> || <tt>#f6f4ec</tt>
| style="background-color: #f6f4ec;" | || {{samp|lmozsand}} || {{samp|#f6f4ec}}
|-
|-
| style="background-color: #d7d3c8;" | || <tt>mozsand</tt> || <tt>#d7d3c8</tt>
| style="background-color: #d7d3c8;" | || {{samp|mozsand}} || {{samp|#d7d3c8}}
|-
|-
| style="background-color: #ea3b28;" | || <tt>lmozred</tt> || <tt>#ea3b28</tt>
| style="background-color: #ea3b28;" | || {{samp|lmozred}} || {{samp|#ea3b28}}
|-
|-
| style="background-color: #c13832;" | || <tt>mozred</tt> ||<tt>#c13832</tt>
| style="background-color: #c13832;" | || {{samp|mozred}} ||{{samp|#c13832}}
|-
|-
| style="background-color: #4d4e53;" | || <tt>mozcoal</tt> || <tt>#4d4e53</tt>
| style="background-color: #4d4e53;" | || {{samp|mozcoal}} || {{samp|#4d4e53}}
|-
|-
| style="text-align: center;" | HEX || Any hex colour value || <tt>#RRGGBB</tt>
| style="text-align: center;" | HEX || Any hex colour value || {{samp|#RRGGBB}}
|-
|-
| style="text-align: center;" | CSS || Any CSS colour name ||
| style="text-align: center;" | CSS || Any CSS colour name ||
Line 273: Line 285:
The alignment of the text, defined using CSS values.
The alignment of the text, defined using CSS values.


The default value is <tt>left</tt>.
The default value is {{samp|left}}.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|talign=alignment value}}</nowiki></code>
* {{tlc|message/box|talign{{=}}alignment value}}


;<big>Available values</big>
;<big>Available values</big>
Line 283: Line 295:
! Value !! style="width:15em;" | Comment
! Value !! style="width:15em;" | Comment
|-
|-
| <tt>left</tt> || style="text-align:left;" | '''Default'''
| {{samp|left}} || style="text-align:left;" | '''Default'''
|-
|-
| <tt>right</tt> || style="text-align:right;" | Right-aligned
| {{samp|right}} || style="text-align:right;" | Right-aligned
|-
|-
| <tt>center</tt> || style="text-align:center;" | Center-aligned
| {{samp|center}} || style="text-align:center;" | Center-aligned
|}
|}


Line 294: Line 306:
The direction of the text, defined using CSS values.
The direction of the text, defined using CSS values.


The default value is <tt>ltr</tt>.
The default value is {{samp|ltr}}.


;<big>Comments</big>
;<big>Comments</big>
* Only use this parameter if you need to enter a message in a language, in which written text runs from the right to the left, e.g. Arabic, Persian or Hebrew.
* Only use this parameter if you need to enter a message in a language, in which written text runs from the right to the left, e.g. Arabic, Persian or Hebrew.
* If you use this parameter, '''do not''' also use the parameter <code>talign</code>! It is preset for <code>tdir</code>=<tt>rtl</tt>.
* If you use this parameter, '''do not''' also use the parameter {{para|talign}}! It is preset for {{para|tdir|rtl}}.
** Setting the direction value to <tt>rtl</tt> will impose the following property change:
** Setting the direction value to {{samp|rtl}} will impose the following property change:
**# <code>talign</code>: the text will be set to <tt>right</tt>, making the text right-aligned.
**# {{para|talign}}: the text will be set to {{samp|right}}, making the text right-aligned.


;<big>Usage</big>
;<big>Usage</big>
* <code><nowiki>{{message/box|tdir=direction value}}</nowiki></code>
* {{tlc|message/box|tdir{{=}}direction value}}


;<big>Available values</big>
;<big>Available values</big>
Line 310: Line 322:
! Value !! style="width:15em;" | Comment
! Value !! style="width:15em;" | Comment
|-
|-
| <tt>ltr</tt> || style="text-align:left; direction:ltr;" | '''Default'''
| {{samp|ltr}} || style="text-align:left; direction:ltr;" | '''Default'''
|-
|-
| <tt>rtl</tt> || style="text-align:right; direction:rtl;" | كتب النص من اليمين إلى اليسار
| {{samp|rtl}} || style="text-align:right; direction:rtl;" | {{bdi|كتب النص من اليمين إلى اليسار}}
|}
|}


Line 318: Line 330:
===Correct use===
===Correct use===
{| class="wikitable" style="background-color: white;"
{| class="wikitable" style="background-color: white;"
|-
! colspan="3" | <h4>General</h4>
|-
|-
! Parameter !! What you write !! What you see
! Parameter !! What you write !! What you see
|-
|-
| No parameters || <code><nowiki>{{message/box}}</nowiki></code> || {{message/box}}
| No parameters || {{tlc|message/box}} || {{message/box}}
|-
|-
| colspan="3" |
| colspan="3" |
|-
|-
! colspan="3" | <big>Box</big>
! colspan="3" | <h4>Box</h4>
|-
|-
! Parameter !! What you write !! What you see
! Parameter !! What you write !! What you see
|-
|-
| <code>class</code> || <code><nowiki>{{message/box|Class set to <tt>messagebox text</tt>|class=text}}</nowiki></code> || {{message/box|Class set to <tt>messagebox text</tt>|class=text}}
| {{code|class}} || {{tlc|message/box|Class set to {{samp|messagebox text}}|class{{=}}text}} || {{message/box|Class set to {{samp|messagebox text}}|class=text}}
|-
|-
| rowspan="3" | <code>bgcolor</code> || <code><nowiki>{{message/box|CSS colour name|bgcolor=magenta}}</nowiki></code> || {{message/box|CSS colour name|bgcolor=magenta}}
| rowspan="3" | {{code|bgcolor}} || {{tlc|message/box|CSS colour name|bgcolor{{=}}magenta}} || {{message/box|CSS colour name|bgcolor=magenta}}
|-
|-
| <code><nowiki>{{message/box|Hex colour code|bgcolor=#FF00FF}}</nowiki></code> || {{message/box|Hex colour code|bgcolor=#FF00FF}}
| {{tlc|message/box|Hex colour code|bgcolor{{=}}#FF00FF}} || {{message/box|Hex colour code|bgcolor=#FF00FF}}
|-
|-
| <code><nowiki>{{message/box|Mozilla colour value|bgcolor=mozsand}}</nowiki></code> || {{message/box|Mozilla colour value|bgcolor=mozsand}}
| {{tlc|message/box|Mozilla colour value|bgcolor{{=}}mozsand}} || {{message/box|Mozilla colour value|bgcolor=mozsand}}
|-
|-
| rowspan="3" | <code>bdcolor</code> || <code><nowiki>{{message/box|CSS colour name|bdcolor=magenta}}</nowiki></code> || {{message/box|CSS colour name|bdcolor=magenta}}
| rowspan="3" | {{code|bdcolor}} || {{tlc|message/box|CSS colour name|bdcolor{{=}}magenta}} || {{message/box|CSS colour name|bdcolor=magenta}}
|-
|-
| <code><nowiki>{{message/box|Hex colour code|bdcolor=#FF00FF}}</nowiki></code> || {{message/box|Hex colour code|bdcolor=#FF00FF}}
| {{tlc|message/box|Hex colour code|bdcolor{{=}}#FF00FF}} || {{message/box|Hex colour code|bdcolor=#FF00FF}}
|-
|-
| <code><nowiki>{{message/box|Mozilla colour value|bdcolor=mozcoal}}</nowiki></code> || {{message/box|Mozilla colour value|bdcolor=mozcoal}}
| {{tlc|message/box|Mozilla colour value|bdcolor{{=}}mozcoal}} || {{message/box|Mozilla colour value|bdcolor=mozcoal}}
|-
|-
| rowspan="2" | <code>width</code> || <code><nowiki>{{message/box|Percentage|width=45%}}</nowiki></code> || {{message/box|Percentage|width=45%}}
| rowspan="2" | {{code|width}} || {{tlc|message/box|Percentage|width{{=}}45%}} || {{message/box|Percentage|width=45%}}
|-
|-
| <code><nowiki>{{message/box|Pixels|width=100px}}</nowiki></code> || {{message/box|Pixels|width=100px}}
| {{tlc|message/box|Pixels|width{{=}}97px}} || {{message/box|Pixels|width=97px}}
|-
|-
| <code>style</code> || <code><nowiki>{{message/box|Styled box|style=text-decoration:overline;font-family: fantasy, cursive, Serif;height: 75px;}}</nowiki></code> || {{message/box|Styled box|style=text-decoration:overline;font-family: fantasy, cursive, Serif;height: 75px;}}
| {{code|style}} || {{tlc|message/box|Styled box|style{{=}}text-decoration:overline;font-family: fantasy, cursive, Serif;height: 75px;}} || {{message/box|Styled box|style=text-decoration:overline;font-family: fantasy, cursive, Serif;height: 75px;}}
|-
|-
| colspan="3" |
| colspan="3" |
|-
|-
! colspan="3" | <big>Image</big>
! colspan="3" | <h4>Image</h4>
|-
|-
! Parameter !! What you write !! What you see
! Parameter !! What you write !! What you see
|-
|-
| <code>image</code> || <code><nowiki>{{message/box|Custom image|image=Green check.png}}</nowiki></code> || {{message/box|Custom image|image=Green check.png}}
| {{code|image}} || {{tlc|message/box|Custom image|image{{=}}Green check.png}} || {{message/box|Custom image|image=Green check.png}}
|-
|-
| <code>imgwidth</code> || <code><nowiki>{{message/box|Larger image|image=Green check.png|imgwidth=75}}</nowiki></code> || {{message/box|Larger image|image=Green check.png|imgwidth=75}}
| {{code|imgwidth}} || {{tlc|message/box|Larger image|image{{=}}Green check.png|imgwidth{{=}}75}} || {{message/box|Larger image|image=Green check.png|imgwidth=75}}
|-
|-
| rowspan="2" | <code>float</code> || <code><nowiki>{{message/box|Floating to the right|float=right}}</nowiki></code> || {{message/box|Floating to the right|float=right}}
| rowspan="2" | {{code|float}} || {{tlc|message/box|Floating to the right|float{{=}}right}} || {{message/box|Floating to the right|float=right}}
|-
|-
| <code><nowiki>{{message/box|Not floating|float=none}}</nowiki></code> || {{message/box|Not floating|float=none}}
| {{tlc|message/box|Not floating|float{{=}}none}} || {{message/box|Not floating|float=none}}
|-
|-
| <code>imgalt</code> || <code><nowiki>{{message/box|Alt text set to "<tt>Olle</tt>"|imgalt=Olle}}</nowiki></code> || {{message/box|Alt text set to "<tt>Olle</tt>"|imgalt=Olle}}
| {{code|imgalt}} || {{tlc|message/box|&amp;larr; Alt text set to "{{samp|Olle}}"|imgalt{{=}}Olle}} || {{message/box|&larr; Alt text set to "{{samp|Olle}}"|imgalt=Olle}}
|-
|-
| rowspan="2" | <code>imglink</code> || <code><nowiki>{{message/box|&larr; Internal wikilink|imglink=L10n:Teams:sv-SE/en}}</nowiki></code> || {{message/box|&larr; Internal wikilink|imglink=L10n:Teams:sv-SE/en}}
| rowspan="2" | {{code|imglink}} || {{tlc|message/box|&amp;larr; Internal wikilink|imglink{{=}}L10n:Teams:sv-SE/en}} || {{message/box|&larr; Internal wikilink|imglink=L10n:Teams:sv-SE/en}}
|-
|-
| <code><nowiki>{{message/box|&larr; URL|imglink=http://www.strindbergandhelium.com/}}</nowiki></code> || {{message/box|&larr; URL|imglink=http://www.strindbergandhelium.com/}}
| {{tlc|message/box|&amp;larr; URL|imglink{{=}}{{nowiki|http://www.strindbergandhelium.com/}}}} || {{message/box|&larr; URL|imglink=http://www.strindbergandhelium.com/}}
|-
|-
| colspan="3" |
| colspan="3" |
|-
|-
! colspan="3" | <big>Text</big>
! colspan="3" | <h4>Text</h4>
|-
! Parameter !! What you write !! style="width:300px;" | What you see
|-
| {{code|1}} || {{tlc|message/box|{{nowiki|You ''can'' '''use''' <sup>wiki</sup> <big>markup</big>}}}} || {{message/box|You ''can'' '''use''' <sup>wiki</sup> <big>markup</big>}}
|-
|-
! Parameter !! What you write !! What you see
| {{code|title}} || {{tlc|message/box|title{{=}}This is the message title|This is the message text}} || {{message/box|title=This is the message title|This is the message text}}
|-
|-
| <code>1</code> || <code><nowiki>{{message/box|You ''can'' '''use''' <sup>wiki</sup> <big>markup</big>}}</nowiki></code> || {{message/box|You ''can'' '''use''' <sup>wiki</sup> <big>markup</big>}}
| rowspan="3" | {{code|fgcolor}} || {{tlc|message/box|CSS colour name|fgcolor{{=}}magenta}} || {{message/box|CSS colour name|fgcolor=magenta}}
|-
|-
| rowspan="3" | <code>fgcolor</code> || <code><nowiki>{{message/box|CSS colour name|fgcolor=magenta}}</nowiki></code> || {{message/box|CSS colour name|fgcolor=magenta}}
| {{tlc|message/box|Hex colour code|fgcolor{{=}}#FF00FF}} || {{message/box|Hex colour code|fgcolor=#FF00FF}}
|-
|-
| <code><nowiki>{{message/box|Hex colour code|fgcolor=#FF00FF}}</nowiki></code> || {{message/box|Hex colour code|fgcolor=#FF00FF}}
| {{tlc|message/box|Mozilla colour value|fgcolor{{=}}mozred}} || {{message/box|Mozilla colour value|fgcolor=mozred}}
|-
|-
| <code><nowiki>{{message/box|Mozilla colour value|fgcolor=mozred}}</nowiki></code> || {{message/box|Mozilla colour value|fgcolor=mozred}}
| rowspan="2" | {{code|talign}} || {{tlc|message/box|Right-aligned text|talign{{=}}right}} || {{message/box|Right-aligned text|talign=right}}
|-
|-
| rowspan="2" | <code>talign</code> || <code><nowiki>{{message/box|Right-aligned text|talign=right}}</nowiki></code> || {{message/box|Right-aligned text|talign=right}}
| {{tlc|message/box|Centered text|talign{{=}}center}} || {{message/box|Centered text|talign=center}}
|-
|-
| <code><nowiki>{{message/box|Centered text|talign=center}}</nowiki></code> || {{message/box|Centered text|talign=center}}
| rowspan="2" | {{code|tdir}} || {{tlc|message/box|متن خود را|tdir{{=}}rtl}} || {{message/box|متن خود را|tdir=rtl}}
|-
|-
| <code>tdir</code> || <code><nowiki>{{message/box|متن خود را|tdir=rtl}}</nowiki></code> || {{message/box|متن خود را|tdir=rtl}}
| {{tlc|message/box|متن خود را|tdir{{=}}rtl|float{{=}}right}} || {{message/box|متن خود را|tdir=rtl|float=right}}
|}
|}


==See also==
==See also==
* {{tl|message}} – the same as <code><nowiki>{{message/box}}</nowiki></code>, minus the option to define the width of the box and some other tweaks.
* {{tl|message}} – the same as {{tlc|message/box}}, minus the option to define the width of the box and some other tweaks.
* {{tl|admon}} – four types of message boxes for various situations, based upon the template <code><nowiki>{{message}}</nowiki></code>.
* {{tl|admon}} – four types of message boxes for various situations, based upon the template {{tlf|message}}.
* {{tl|label}} – strong message box for incredibly important messages. Use only if absolutely necessary.
* {{tl|label}} – strong message box for incredibly important messages. Use only if absolutely necessary.



Latest revision as of 20:32, 29 January 2015

Edit-copy green.svg
This is a documentation subpage for Template:Message/box.
It contains usage information, categories and other content that is not part of the original template page.

Usage

{{message/box}} displays a custom made message box, just as {{message}}, but with some added options:

  • message title
  • maximum box width
  • image float
  • custom image alt text
  • custom image link (default: no link)
  • text alignment
  • text direction
  • Mozilla colours available for the background and border
  • Mozilla colours available for the foreground

The two default colours for the background and the border, sand start and sand respectively, are set in accordance with the Mozilla style guide. These two and the remaining Mozilla colours have been given their own values for easy use.

Parameters

There are 14 parameters in total, 1 unnamed and 13 named, none of which is required for the template to work. Some parameters will affect other parameters or CSS properties if entered, or if set to a specific value. Read the descriptions of the parameters below to learn about these cases.

List of parameters
Template parameters
Element Parameter Description Default value
Box class CSS class amendment null
bgcolor Background colour #f6f4ec
bdcolor Border colour #d7d3c8
width Box width none
style Additional CSS styling null
Image image Image shown in the box Idea.png
imgwidth Image width 35 (px)
float Image float left
imgalt Image alt text image file name
imglink Image link empty
Text 1 (unnamed) Message text null
title Messagebox title (header) null
fgcolor Foreground (text) colour black
talign Text alignment left
tdir Text direction ltr
Copy-paste templates
Size Template code
Basic {{message/box|text|title=}}
Common use {{message/box|text|title=|bgcolor=|bdcolor=|width=|image=|float=}}}}
All parameters {{message/box|text|title=|class=|bgcolor=|bdcolor=|width=|style=|image=|imgwidth=|float=|imgalt=}}

Box parameters

class

Class

A custom CSS class to append to the box's default class messagebox.

If you, for exampl0e, set the value to german, the resulting <div> attribute will be <div class="messagebox german">.

The default value is null.

Usage
  • {{message/box|class=class name}}

bgcolor

Background colour

The background colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. white) or a hexadecimal colour code (e.g. #ffffff for white).

The default value is #f6f4ec  (Mozilla colour "sand (gradient start)").

Usage
  • {{message/box|bgcolor=colour code/value}}
Available values
Value Hex Comment
lmozsand #f6f4ec Default
mozsand #d7d3c8
lmozred #ea3b28
mozred #c13832
mozcoal #4d4e53
HEX Any hex colour value #RRGGBB
CSS Any CSS colour name

bdcolor

Border colour

The border colour of the box, defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. black) or a hexadecimal colour code (e.g. #000000 for black).

The default value is #d7d3c8  (Mozilla colour "sand").

Usage
  • {{message/box|bdcolor=colour code/value}}
Available values
Value Hex Comment
lmozsand #f6f4ec
mozsand #d7d3c8 Default
lmozred #ea3b28
mozred #c13832
mozcoal #4d4e53
HEX Any hex colour value #RRGGBB
CSS Any CSS colour name

width

Box width

You can define the maximum width of the message box in pixels, or as a percentage of the available width.

The default value is none.

Comment
  • When defining the message box width, enter the numerical value and the unit (% or px) as one word, i.e without any spaces, e.g. 60% or 350px.
Usage
  • {{message/box|width=numerical value and unit}}

style

CSS styling

Optional CSS properties with corresponding values. This parameter specifies the style used by the entire message box.

The default value is null.

Comments
  • Properties have to be enetered without quotation marks ("…") but with the ending semicolon (;).
  • Don't define properties that already are regulated by other parameters in this template.
Usage
  • {{message/box|style=prop1:value1; prop2:value2;}}

Image parameters

image

Image

You can choose a custom image to be used in the template, by using the image parameter. By default, the image is displayed on the left side inside the box, to the left of the text.

The default image is Idea.png (File:Idea.png).

Comments
  • The image must previously have been uploaded to MozillaWiki. See Category:Icons or the MozillaWiki file list.
  • When defining an image, don't include the namespace (File:). That is inserted automatically.
Usage
  • {{message/box|image=name.ext}}

imgwidth

Image width

The width of the used image (in pixels), defined as a numerical value.

The default value is 35.

Comments
  • When defining the image width, don't include the unit (px). That is inserted automatically.
  • The image width affects the margin of the box, allowing it to float without getting covered by text.
Usage
  • {{message/box|imgwidth=numerical value}}

float

Image float

You can change the image's float to floating on the right-hand side, or to no float at all.

The default value is left.

Comment
  • Setting the float value to right affects the left- and right-hand margins of the box, shifting them to give the image the space it needs on the right (so it doesn't get covered by text), and allowing extra space for the text on the left.
Usage
  • {{message/box|float=float value}}
Available values
Value Comment
left
Default
right
Image floats to the right
none
No floating, image treated
as a separate block

imgalt

Image alt text

By default, the image's alt text is the same as the image's name, e.g. "Idea.png" for the default image. But it is possible to specify a custom alt text using this parameter.

Usage
  • {{message/box|imgalt=custom text}}

imglink

Image link

By default, the image link is disabled, but it is possible to specify a custom link with this parameter.

The default value is null.

Comments
  • When entering an internal wikilink, don't include the brackets ([[…]]). Example: L10n:Home Page
  • When entering an URL, include the protocol (http://, https://, etc.). Example: https://www.mozilla.org/sv-SE/
Usage
  • {{message/box|imglink=wikilink/URL}}

Text parameters

1 (unnamed)

Message text

Custom text string, wiki-formatting can be used. The parameter is unnamed, so no parameter name needs to be entered.

The default value is null, but without defining this parameter, i.e. including a message, the template is more or less useless as a message box.

Usage
  • {{message/box|custom text}}

title

Message title

Custom text string, output in bold and larger text-size. The message text will be displayed one line beneath the title.

The default value is null.

Usage
  • {{message/box|title=custom text}}

fgcolor

Foreground colour

The foreground colour of the box (i.e. text colour), defined as a Mozilla colour value (see the table below), a CSS colour name (e.g. black) or a hexadecimal colour code (e.g. #000000 for black).

The default colour is black (i.e the CSS name value).

Usage
  • {{message/box|fgcolor=colour code/value}}
Available values
Value Hex
lmozsand #f6f4ec
mozsand #d7d3c8
lmozred #ea3b28
mozred #c13832
mozcoal #4d4e53
HEX Any hex colour value #RRGGBB
CSS Any CSS colour name

talign

Text alignment

The alignment of the text, defined using CSS values.

The default value is left.

Usage
  • {{message/box|talign=alignment value}}
Available values
Value Comment
left Default
right Right-aligned
center Center-aligned

tdir

Text direction

The direction of the text, defined using CSS values.

The default value is ltr.

Comments
  • Only use this parameter if you need to enter a message in a language, in which written text runs from the right to the left, e.g. Arabic, Persian or Hebrew.
  • If you use this parameter, do not also use the parameter |talign! It is preset for |tdir=rtl.
    • Setting the direction value to rtl will impose the following property change:
      1. |talign: the text will be set to right, making the text right-aligned.
Usage
  • {{message/box|tdir=direction value}}
Available values
Value Comment
ltr Default
rtl كتب النص من اليمين إلى اليسار

Examples

Correct use

General

Parameter What you write What you see
No parameters {{message/box}}
Idea.png

Box

Parameter What you write What you see
class {{message/box|Class set to messagebox text|class=text}}
Idea.png
Class set to messagebox text
bgcolor {{message/box|CSS colour name|bgcolor=magenta}}
Idea.png
CSS colour name
{{message/box|Hex colour code|bgcolor=#FF00FF}}
Idea.png
Hex colour code
{{message/box|Mozilla colour value|bgcolor=mozsand}}
Idea.png
Mozilla colour value
bdcolor {{message/box|CSS colour name|bdcolor=magenta}}
Idea.png
CSS colour name
{{message/box|Hex colour code|bdcolor=#FF00FF}}
Idea.png
Hex colour code
{{message/box|Mozilla colour value|bdcolor=mozcoal}}
Idea.png
Mozilla colour value
width {{message/box|Percentage|width=45%}}
Idea.png
Percentage
{{message/box|Pixels|width=97px}}
Idea.png
Pixels
style {{message/box|Styled box|style=text-decoration:overline;font-family: fantasy, cursive, Serif;height: 75px;}}
Idea.png
Styled box

Image

Parameter What you write What you see
image {{message/box|Custom image|image=Green check.png}}
Green check.png
Custom image
imgwidth {{message/box|Larger image|image=Green check.png|imgwidth=75}}
Green check.png
Larger image
float {{message/box|Floating to the right|float=right}}
Idea.png
Floating to the right
{{message/box|Not floating|float=none}}
Idea.png
Not floating
imgalt {{message/box|&larr; Alt text set to "Olle"|imgalt=Olle}}
Olle
← Alt text set to "Olle"
imglink {{message/box|&larr; Internal wikilink|imglink=L10n:Teams:sv-SE/en}}
Idea.png
← Internal wikilink
{{message/box|&larr; URL|imglink=http://www.strindbergandhelium.com/}}
Idea.png
← URL

Text

Parameter What you write What you see
1 {{message/box|You ''can'' '''use''' <sup>wiki</sup> <big>markup</big>}}
Idea.png
You can use wiki markup
title {{message/box|title=This is the message title|This is the message text}}
Idea.png
This is the message title
This is the message text
fgcolor {{message/box|CSS colour name|fgcolor=magenta}}
Idea.png
CSS colour name
{{message/box|Hex colour code|fgcolor=#FF00FF}}
Idea.png
Hex colour code
{{message/box|Mozilla colour value|fgcolor=mozred}}
Idea.png
Mozilla colour value
talign {{message/box|Right-aligned text|talign=right}}
Idea.png
Right-aligned text
{{message/box|Centered text|talign=center}}
Idea.png
Centered text
tdir {{message/box|متن خود را|tdir=rtl}}
Idea.png
متن خود را
{{message/box|متن خود را|tdir=rtl|float=right}}
Idea.png
متن خود را

See also

  • {{message}} – the same as {{message/box}}, minus the option to define the width of the box and some other tweaks.
  • {{admon}} – four types of message boxes for various situations, based upon the template {{message}}.
  • {{label}} – strong message box for incredibly important messages. Use only if absolutely necessary.