Template:Center/doc

This utility template centers text inside an HTML box that is wrapped around the  tags inside which is the text you supplied to the template's single, unnamed parameter, 1. The tags have 0.75em of padding on all sides and the  box has margins of 1em set above and below while the left and right margins are automatically sized to be identical (the result of calculating , which is the mechanism that actually centers the content on the page or inside whatever other smaller container it was placed in).

Usage


The style parameter is entirely optional and only intended to provide a way to overcome minor issues with text size and spacing. If used as intended, wrapped around text needing to be centered on the page, with any wikitext style desired applied outside the template, this template should be reliable and fairly versatile.

Example
You have not the power to bind me to either side of the page! which produces: You have not the power to bind me to either side of the page!

Caveats
While not required, it's good to cultivate the habit of prepending  to the text you want centered, since that eliminates any chance of the template being broken by text that happens to have an equality sign  already present in it. Absent that situation and a few exceedingly rare others, it is perfectly acceptable to call it in its simplest form, e.g..

Spacing
The default padding and margin choices can be desirable in many cases as it sets off the text nicely from its surroundings, but that assumes it is the last (or only) text on a line—which can adversely affect wikitext using || separators in tables.

Text size
It can also have undesirable 'enlarging' effects on the font used as a result of the double nested tag pairs, again, especially in tables. This is a good use for the style parameter; feeding it values of, where   is a decimal number whose default value is 1.0 (that represents the font size of the template's current output), can correct these issues. When  < 1, e.g. , the font size is reduced in proportion to the amount subtracted from 1 to achieve  , in this example a reduction of 5%. The reverse holds true for values of  that are > 1, if you need to enlarge the text instead.

TemplateData
{	"description": "Formatting template that centers text on the page or inside of whatever container the template is placed within; a drop-in replacement for the long-deprecated ... tags of yore.", "format": "inline", "paramOrder": [ "1",		"style" ],	"params": { "1": {			"aliases": [ "content", "text" ],			"label": "Input text", "description": "The text you wished to appear centered wherever this template is placed", "example": "Center me.", "type": "string", "required": true },		"style": { "label": "Inline CSS", "description": "Any extra inline CSS3 style definitions can be supplied to this parameter for inclusion in the ... wrapper tags (don't forget to include the semicolon at the end of each one)", "example": "font-size: 1.1em; font-weight: bold;", "type": "line" }	} }