Template:Center/doc: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) |
ArrowHead294 (talk | contribs) mNo edit summary |
||
Line 3: | Line 3: | ||
<pre><div style="text-align: center;"> | <pre><div style="text-align: center;"> | ||
<div style=" | <div style="margin: auto auto auto auto;"> | ||
... | ... | ||
</div> | </div> | ||
Line 15: | Line 15: | ||
; <code>width</code> (optional) | ; <code>width</code> (optional) | ||
: Pass in the desired width | : Pass in the desired width (if needed). | ||
; <code>top</code> (optional) | ; <code>top</code> (optional) |
Revision as of 14:04, 17 January 2025
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="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 (if needed).
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. Note that this will override any margin specified using
top
orbottom
.