Template:Box/doc
This is a generic template, nominally designed for use by other templates. You can use it directly, but you might be better off using one of its derived templates.
Principal derived templates are Template:SideBox, Template:FullBox and Template:TextBox. For more details, see the documentation for those individual templates.
What it does
This template creates a box. The size, position and colour of the box is configurable through the supplied arguments.
Usage
{{Box
|bg=<background colour (HTML style)>
|fg=<foreground colour (HTML style)>
|minw=<minimum width (ems)>
|maxw=<maximum width (ems)>
|pad=<padding (ems horizontally, exs vertically)>
|br=<border colour (HTML style)>
|brl=<wide left border colour (HTML style)>
|mgn=<margin (ems horizontally, exs vertically)>
|bmgn=<bottom margin (exs)>
|flt=<float direction ("left" or "right")>
|tag=<tag type ("div", the default, or "span")>
|text=<text>}}
All of the arguments are optional, including text.
bg and fg
These specify a background and foreground colour, respectively, in HTML style, eg #RGB or #RRGGBB. If either or both is missing, then the box will inherit the corresponding colour(s) from the page.
minw and maxw
These specify a minimum and maximum width, respectively, in ems. They are normally used in conjunction with float to limit the size of the box, which would otherwise default to full width (block box) or to the size of the enclosed elements (inline box).
pad
This specifies padding (space between the contents of the box and its border). The same figure is used for horizontal and vertical padding, except that horizontal padding is specified in ems and vertical in exs.
br
This specifies a border colour, HTML style, eg #RGB or #RRGGBB. The border will be solid, 1 pixel wide. If this is missing, then the box will have no border.
brl
This specifies a wide left border colour, HTML style, eg #RGB or #RRGGBB. The border will be solid, 0.5em wide. If this is missing, then the box will have no wide left border, and the left border will be inherited from that specified by br (if any).
mgn
This specifies margin (space between the box border and surrounding elements). The same figure is used for horizontal and vertical margin, except that horizontal margin is specified in ems and vertical in exs.
bmgn
This specifies bottom margin in exs. It would not normally be used in conjunction with mgn.
flt
This specifies the float direction, if any. If present, it should be either left or right to float the box. If this is missing, then the box will not float.
Note that in the absence of minw and/or maxw, the box may occupy 100% of the available width. In this case, it will not float as there is nowhere left for it to float to.
tag
This specifies the type of box. If present, it should be either div to create a block box, or span to create an inline box. If this is missing, then the default div will be used.
text
This specifies the content of the box, which may itself be plain text, wiki markup, HTML markup or other templates.
If this is missing, then the entire box is suppressed. This is useful for derived templates that rely on conditional code.
Derived templates
As stated in the lead, this is a generic template, nominally designed for use by other templates. Such derived templates provide sensible defaults for many arguments and greatly simplify the majority of use cases.
Principal derived templates are Template:SideBox, Template:FullBox and Template:TextBox. For more details, see the documentation for those individual templates.