Template:Center/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 1: Line 1:
{{dochead}}{{wikipedia}}
{{dochead}}{{wikipedia}}
The <code><<nowiki />center></code> tag in {{w|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 CSS within a <code><<nowiki />div></code> elements as a workaround: {{clear}}
The <code><nowiki><center></nowiki></code> tag in {{w|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 CSS within a <code><nowiki><div></nowiki></code> elements as a workaround: {{clear}}


<pre><div style="text-align: center; width: auto; margin: auto auto auto auto;">
<pre><div style="text-align: center; width: auto; margin: auto auto auto auto;">
Line 9: Line 9:


=== Parameters ===
=== Parameters ===
; <code>{{{<nowiki />1}}}</code> '''(required)'''
; <code><nowiki>{{{1}}}</nowiki></code> '''(required)'''
: One unnamed parameter, consisting of the text to be centered.
: One unnamed parameter, consisting of the text to be centered.



Revision as of 15:21, 18 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 CSS within a <div> elements as a workaround:

<div style="text-align: center; width: auto; margin: auto auto auto auto;">
...
</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.