Template:Block center/doc

Usage
This template places a block of text in the center of the page, without affecting the text alignment within that block. undefined is another template which does the same thing.

This template retains the current text alignment (usually left), but moves the entire block of text into the center. To change to centered text alignment, use center instead.
 * Comparison of undefined and Center




 * Center:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.

Aenean massa.

Parameters
All parameters are optional except for the text.
 * ,, : the text to be placed centrally as a block.
 * : title of the block.
 * : the width of the block (needs units which are valid CSS units).
 * : the maximum width of the block (needs units which are valid CSS units).
 * : the height of the block (needs units which are valid CSS units). Use adds pages to Category:Pages using center block with height parameter.
 * : the text alignment within the block. One of,  ,  ,  ; default is unspecified and so inherits from the parent.
 * : additional CSS classes, which can be used in conjunction with index CSS. The classes  and   are always applied to the block and the title respectively.
 * : additional CSS styles (prefer a class if the style is re-used within a work).

Where there is a need to give the title of the work, an optional "title" parameter can be used. Sometimes this is will center the title better than a stand-alone line will; other times not - it usually depends on if a fixed width (next example) is forced or not.

Where there is a requirement to fix the width of the block, an optional "width" parameter can be used. Sometimes this is required to force a wider width when line wrap occurs.

For exactly the same "spacing" as rendered by normal paragraph(s) before and/or after the template-inserted content:

By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.

Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Note: this will force the width even when the page is narrower than the given width, up to the maximum specified by, or 100% if that's not given.

Note: generally, avoid using percentages, as this will probably be unreasonably narrow on small screens. If the content is text, prefer text-relative CSS units, such as em. See H:PXWIDTH for more details.

This parameter provides a maximum width for the block, such that no matter how wide the parent container, the centered block will be no wider than this. Very often, this is a better choice than, because it allows content to shrink on smaller screens like e-readers.

However, if the parent container is smaller that this value, the block will shrink as normal:

The two parameters can be combined. In this case, the width will be set according to the parameter on small screens (below the max-width value), and then will be limited to the  value on large screens. Note that the width value has to change according to the parent size, so it's normally a percentage value (often 100%).

This is useful when there are floated blocks that don't cause the block to expand to the correct width, but where it's still desirable for the block to shrink on smaller screens:

The text alignment within the (overall) centered block may be controlled using this parameter.

Where there is a need to specify the style of the text, an optional "style" parameter can be used. This parameter takes the same style attributes that can be set for any table.

For slightly larger "spacing" between normal paragraph(s) before &/or after the template-inserted content:

By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.

Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Spanning multiple pages
If you use many separate you will find that every page has a slightly different alignment; however, this template cannot be left "dangling" and closed on another page to create one big. If you have a multipage, you can use /s and /e to open and close it on each page. Every page must have one of each, one at the start and one at the end. However, you may place one or both of them in the header or footer, so they will not be transcluded to the main namespace. When the pages are all transcluded, you will end up with just one /s and just one /e at the start and end of the section, respectively. See Help:Page breaks for more information.

First page
Nothing is required in the header
 * Header


 * Body

Start of the text. Contents of the goes here.


 * Footer

Middle pages

 * Header

Contents of the go here; this continues the previous page.
 * Body


 * Footer

Last page

 * Header

Contents of the go here; this continues the previous page. Last bit of text.
 * Body

Nothing is required in the footer of the last page.
 * Footer

Tracking categories

 * Category:Pages using center block with title parameter
 * Category:Pages using center block with style parameters
 * Category:Pages using center block with class parameter
 * Category:Pages using center block with height parameter
 * Category:Pages using center block with width parameter
 * Category:Pages using center block with max-width parameter
 * Category:Pages using center block with align parameter
 * Category:Pages using center block with style parameter

TemplateData
{	"params": { "class": { "label": "class", "description": "Additional CSS classes, which can be used in conjunction with index CSS", "type": "line" },		"width": { "label": "width", "description": "The width of the block (needs units which are valid CSS units)", "type": "line" },		"align": { "aliases": [ "talign" ],			"label": "align", "description": "The text alignment within the block", "suggestedvalues": [ "left", "center", "right", "justify" ],			"type": "line", "default": "inherit" },		"max-width": { "type": "line", "description": "The maximum width of the block (needs units which are valid CSS units)" },		"style": { "label": "style", "description": "Additional CSS styles", "type": "line" },		"title": { "label": "title", "description": "Title of the block", "type": "content" },		"height": { "type": "line", "description": "The height of the block (needs units which are valid CSS units)" },		"text": { "aliases": [ "1",				"body" ],			"description": "Content to place in a centered block", "type": "content", "required": true }	},	"format": "block", "description": "Render content in a centered block", "paramOrder": [ "text", "title", "class", "height", "width", "max-width", "align", "style" ] }