• Home
  • Random
  • Log in
  • Settings
Donate Now If this site has been useful to you, please give today.
  • About Wikisource
  • Disclaimers
Wikisource

Template:Center

  • Template
  • Discussion
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
Shortcut:
{{c}}
WarningThis template is used on approximately 668,000 pages, or roughly 14% of all 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.
CSSThis template uses TemplateStyles:
  • Template:center/styles.css

This template uses block elements, e.g. <div> or <p>.
It should not be nested inside an inline element, e.g. <span>, or a template that produces such an element.

See H:DIVSPAN for details.

Contents

  • 1 Usage
    • 1.1 Other parameters
      • 1.1.1 style
  • 2 Redirects
  • 3 Tracking categories
  • 4 See also
    • 4.1 Template data

Usage

This template center-aligns text. For example,

Example

{{center|'''Example text'''}}

Example text

Other parameters

style

Where there is a need to specify the style of text for the whole <div>...</div> item, an optional style parameter can be used.

This can be useful when the body of the template is not a single inline item but a multi-paragraph structure. If the formatting in question has a "block" template, you can also nest that inside or outside the {{center}} template:

The following solutions are then applicable.

Option 1

{{center|style=font-family:serif;|
Title of the work

by

Author of the work
}}

yields

Title of the work

by

Author of the work

Option 2 (block template)

{{center|{{serif block|
<!--or {{serif block|{{center| -->
Title of the work

by

Author of the work
}}}}

yields

Title of the work

by

Author of the work

Option 3 (if block template not available)

{{center|
{{serif|Title of the work}}

{{serif|by}}

{{serif|Author of the work}}
}}

yields

Title of the work

by

Author of the work

Redirects

  • {{c}}

Tracking categories

  • Category:Pages using center with no text argument—Pages where the template is called with no text or first argument, typically because the content contains an = or otherwise confuses the parser

See also

  • Template:Block center
  • Template:Center block
  • Template:Center inline (span-based version)

Template data

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Center

Align text to the center

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
stylestyle

Additional CSS styles to apply to the block

Contentoptional
texttext 1

The text to center, this can be more than one paragraph.

Contentrequired
nomarginnomargin

no description

Suggested values
yes, no
Stringoptional
nocatnocat

no description

Unknownoptional
classclass

Additional CSS classes to apply.

Unknownoptional
widthwidth

no description

Unknownoptional
The above documentation is transcluded from Template:Center/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikisource.org/w/index.php?title=Template:Center&oldid=14892253"
Last edited on 23 February 2025, at 22:10

Languages

    • العربية
    • অসমীয়া
    • Azərbaycanca
    • Basa Bali
    • Bikol Central
    • Беларуская
    • বাংলা
    • Brezhoneg
    • Bosanski
    • Català
    • Čeština
    • Cymraeg
    • Dansk
    • Deutsch
    • Ελληνικά
    • Esperanto
    • Español
    • Eesti
    • Euskara
    • فارسی
    • Français
    • Galego
    • ગુજરાતી
    • עברית
    • हिन्दी
    • Հայերեն
    • Bahasa Indonesia
    • Italiano
    • 日本語
    • Jawa
    • 한국어
    • Latina
    • Ligure
    • Македонски
    • Bahasa Melayu
    • မြန်မာဘာသာ
    • Napulitano
    • Nederlands
    • Norsk
    • ଓଡ଼ିଆ
    • ਪੰਜਾਬੀ
    • Polski
    • Piemontèis
    • Português
    • Română
    • Русский
    • संस्कृतम्
    • Slovenčina
    • Српски / srpski
    • Sunda
    • Svenska
    • தமிழ்
    • తెలుగు
    • ไทย
    • Türkçe
    • Українська
    • Vèneto
    • Tiếng Việt
    • 中文
    Wikisource
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 23 February 2025, at 22:10.
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikisource
    • Disclaimers
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop