Template:Center
From Wikipedia, the free encyclopedia
This template is used on approximately 232,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Description
It is to center elements on a page. See also Template:Align for more options and flexibility.
Usage
See also: Span and div
More information Markup, Renders as ...
Markup | Renders as |
---|---|
{{Center|Hello world!}} |
Hello world!
|
Close
To do this without a template, simply use the following code:
<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">...</div>
To center a table, see Help:TABLECENTER.
Notes:
- If the markup to be centered includes an equals sign, the markup must be preceded by
1=
. Example:{{Center|1=the <span style="color:red">red</span> one}}
. - If the markup to be centered includes a displaying pipe, the pipe must be escaped as
{{!}}
or|
.
Tables
Using {{left}}
/ {{center}}
/ {{right}}
More information Header text ...
Header text | ||
---|---|---|
Left | Center | Right |
Close
Using {{align|left}}
/ {{align|center}}
/ {{align|right}}
More information Header text ...
Header text | ||
---|---|---|
Left | Center | Right |
Close
Tracking categories
TemplateData
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Center in articles based on its TemplateData.
TemplateData for Center
More information Parameter, Description ...
Parameter | Description | Type | Status | |
---|---|---|---|---|
Content | 1 | Content to be centered | Content | required |
Custom CSS | style | Optional css styling for the centered text | String | optional |
Close
See also
- {{Center block}}
- {{align}}
- {{right}}, {{left}} and {{justify}}
- {{Image frame}}
- {{Table alignment}} - to align whole columns in tables.
The above documentation is transcluded from Template:Center/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.