Template:Center/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
ArrowHead294 (talk | contribs)
mNo edit summary
Line 14: Line 14:
: One unnamed parameter, consisting of the text to be centered.
: One unnamed parameter, consisting of the text to be centered.


; <code>style</code>'''(optional)'''
; <code>style</code> '''(optional)'''
: Custom styling can be achieved by passing in the desired CSS using this argument.
: Custom styling can be achieved by passing in the desired CSS using this argument.

Revision as of 16:21, 4 December 2024

The <center> tag was deprecated in HTML 4, and there is no easy replacement for it. This template replicates the tag's functionality using a workaround via nested <div> elements:

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

This template eliminates the need to manually type out the <div> elements every time something needs to be centered.

Parameters

{{{1}}} (required)
One unnamed parameter, consisting of the text to be centered.
style (optional)
Custom styling can be achieved by passing in the desired CSS using this argument.