Template:Message/box/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
==Usage==
==Usage==
{{tl|message/box}} displays a custom made message box, just as {{tl|message}}, but with the added option to define the maximum width of the box. Furthermore, the image is automatically given an alternative text, and the image shown at the page is non-clickable (i.e. it doesn't link to the original file when clicked).
{{tl|message/box}} displays a custom made message box, just as {{tl|message}}, but with the added option to define the maximum width of the box. Furthermore, the image is automatically given an alternative text, and the image shown at the page is non-clickable (i.e. it doesn't link to the original file when clicked).
{{note|This template may be complicated to use. For an easy-to-use alternative, see {{tl|admon/tip}}.}}


==Parameters==
==Parameters==

Revision as of 17:43, 20 November 2014

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 the added option to define the maximum width of the box. Furthermore, the image is automatically given an alternative text, and the image shown at the page is non-clickable (i.e. it doesn't link to the original file when clicked).

Note: This template may be complicated to use. For an easy-to-use alternative, see {{admon/tip}}.

Parameters

Parameter Description
class Custom CSS class amendment
bgcolor Background colour
bdcolor Border colour
fgcolor Foreground (text) colour
image Image to be shown in the box
imgwidth Image width (in pixels)
width Box width (in percent of available width)
style Custom CSS styling
Copy-paste templates
Size Code
Basic {{message/box|''text''}}
Common use {{message/box|''text'' |bgcolor= |bdcolor= |image= |width= }}
All parameters {{message/box|''text'' |class= |bgcolor= |bdcolor= |fgcolor= |image= |imgwidth= |width= |style= }}

Mandatory parameter

Text

1

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

Note:

  • If this parameter is left out, its name in the template code, "{{{1}}}", will be displayed.
Usage
  • {{message/box|''text''}}

Optional parameters

CSS class

class

A custom CSS class to append to the box's default class messagebox, e.g. messagebox small.

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

Colours

bgcolor

The background colour of the box, defined as a CSS colour name (e.g. white) or a hexadecimal colour code, e.g. #ffffff for white. The default colour is #f9f6b7.

Usage
  • {{message/box|1|bgcolor=CSS/hex colour}}
bdcolor

The border colour of the box, defined as a CSS colour name (e.g. black) or a hexadecimal colour code, e.g. #000000 for black. The default colour is #c4c295.

Usage
  • {{message/box|1|bdcolor=CSS/hex colour}}
fgcolor

The foreground colour of the box (i.e. text colour), defined as a CSS colour name (e.g. green) or a hexadecimal colour code (e.g. #008000 for green). The default colour is black.

Usage
  • {{message/box|1|fgcolor=CSS/hex colour}}

Image

image

You can choose a specific image to use for the template by using the image parameter. The image is displayed on the left side in the box, to the left of the text. The default image is Idea.png (File:Idea.png).

Notes:

  • When defining an image, don't include the namespace (File: or Image:). That is inserted automatically.
  • The image's alt text is the same as the image's name. Thus, the default is "Idea.png".
Usage
  • {{message/box|1|image=name.ext}}
imgwidth

The width of the used image (in pixels). The default value is 35.

Note:

  • When defining the image width, don't include the unit (px or pixels). That is inserted automatically.
Usage
  • {{message/box|1|imgwidth=number value}}

Box width

width

You can define the maximum width of the message box (in percent of the available width). The default value is 100 (full width).

Note:

  • When defining the message box width, don't include the unit (%). That is inserted automatically.
Usage
  • {{message/box|1|width=number value}}

CSS styling

style

Optional CSS properties with corresponding values may be defined, without quotation marks " " but with the ending semicolons ;. The parameter specifies the style used by the entire message box.

Usage
  • {{message/box|1|style=property1:value1; property2:value2;}}

Examples

Correct use

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
class {{message/box|Custom text|class=text}}
Idea.png
Custom text
bgcolor {{message/box|Custom text|bgcolor=white}}
Idea.png
Custom text
{{message/box|Custom text|bgcolor=#ffffff}}
Idea.png
Custom text
bdcolor Custom text|bdcolor=black}}
Idea.png
Custom text
{{message/box|Custom text|bdcolor=#000000}}
Idea.png
Custom text
fgcolor {{message/box|Custom text|fgcolor=green}}
Idea.png
Custom text
{{message/box|Custom text|fgcolor=#008000}}
Idea.png
Custom text
image {{message/box|Custom text|image=Green check.png}}
Green check.png
Custom text
imgwidth {{message/box|Custom text|image=Green check.png|imgwidth=75}}
Green check.png
Custom text
width {{message/box|Custom text|width=25}}
Idea.png
Custom text
style {{message/box|Custom text|style=text-align:right;}}
Idea.png
Custom text

Incorrect use

Example case What you write What you see (error)
No parameter {{message/box}}
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.