Template:Center/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
m -double bold
ArrowHead294 (talk | contribs)
Line 22: Line 22:
; <code>bottom</code> (optional)
; <code>bottom</code> (optional)
: Pass in the desired lower margin; the default value is <code>auto</code>.
: Pass in the desired lower margin; the default value is <code>auto</code>.
; <code>both</code> (optional)
: Pass in this to set both upper and lower margins to the same desired value.

Revision as of 19:27, 27 December 2024

English Wikipedia has an article on:

The <center> tag in HTML is now deprecated, and there is no one-size-fits-all replacement for it. This template is designed to replicate the tag's functionality using nested <div> elements as a workaround:

<div style="text-align: center;">
    <div style="width: auto; margin: auto auto auto auto;">
    ...
    </div>
</div>

This way, there is no need to manually type out the needed elements every time something needs to be centered.

Parameters

{{{1}}} (required)
One unnamed parameter, consisting of the text to be centered.
width (optional)
Pass in the desired width; the default value is auto.
top (optional)
Pass in the desired upper margin; the default value is auto.
bottom (optional)
Pass in the desired lower margin; the default value is auto.
both (optional)
Pass in this to set both upper and lower margins to the same desired value.