Template talk:Center
Page contents not supported in other languages.
{{editprotected}}
Please replace the current code with the below:
<includeonly><div class="center">{{{1}}}</div></includeonly><noinclude>{{documentation}}</noinclude>
--fryed-peach (talk) 18:13, 29 March 2009 (UTC)[reply]
{{editprotected}}
Admin, please copy Template:Center/sandbox to Template:Center. --fryed-peach (talk) 15:31, 4 April 2009 (UTC)[reply]
{{Left}} and {{left2}} are table cell alignment templates and have nothing to do with {{center}} or {{right}}.
The example table has not context, thus is useless.
The template is currently defined as:
<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">...</div>
center
is defined in mediawiki.skinning/elements.less
:
/* Emulate Center */.center { width: 100%; text-align: center;}*.center * { margin-left: auto; margin-right: auto;}
The problem with class=center
alone is that it sets width: 100%;
which is often undesirable. The template overrides this with width: auto;
.
Seems to me this would be simpler as:
<div style="text-align: center; width:auto; margin-left:auto; margin-right:auto;">...</div>
-- Gadget850 talk 23:13, 5 March 2015 (UTC)[reply]
-- [[User:Edokter]] {{talk}}
00:18, 6 March 2015 (UTC)[reply]-- [[User:Edokter]] {{talk}}
09:13, 6 March 2015 (UTC)[reply]please update to use the code in this version of the sandbox, which is equivalent to making this change. basically, it adds tracking for the case when the input is blank or missing, which would be pointless, since the template generates an empty div in that case. this is also (sometimes) useful for tracking cases when there is an unescaped = in the input. Frietjes (talk) 16:05, 18 March 2015 (UTC)[reply]
-- [[User:Edokter]] {{talk}}
16:15, 18 March 2015 (UTC)[reply]currently, the {{left}} and {{right}} templates do two slightly different things, depending on if they are passed an unnamed input. for example (see the code)
left text | default text | right text |
left text | default text | right text |
I propose to update this template to this version which will make the syntax match {{left}}
and {{right}}
. since Category:Pages using center with no arguments is empty, this would cause no change in existing transclusions. comments or suggestions? Frietjes (talk) 15:04, 14 July 2015 (UTC)[reply]
-- [[User:Edokter]] {{talk}}
19:16, 13 October 2015 (UTC)[reply]It would be really helpful if at the top of the page there was a link to learn how to have the output of the template center on the page, I can't find this information and I keep coming back to this page.
Thanks
Mrjohncummings (talk) 14:36, 15 September 2015 (UTC)[reply]
Smarttechagra (talk) 07:17, 3 May 2016 (UTC)[reply]
It appears that all the CSS declarations in this template's style attribute do nothing. Auto width on a div is the same as default, 100%. The margins are redundant with the center class. Would it be safe to just delete these declarations? See sandbox and testcases.
While I'm at it, neither the live nor sandbox version works on mobile. Perhaps a quick and dirty text-align:center might patch it up until TemplateStyles is in? Matt Fitzpatrick (talk) 02:51, 27 August 2017 (UTC)[reply]
This change implements a tracking category, Pages using center with too many arguments (implemented on the sandbox version), which is designed to serve basically the same functionality as Pages using center with no arguments. Since any text other than 1=
won't be displayed, having a list of malformed uses would be useful for fixing. I've already done a (very rough) regex search and found a couple of pages with this issue, but a tracking category would be more helpful. Aidan9382 (talk) 14:46, 10 November 2022 (UTC)[reply]
|2=
. – Jonesey95 (talk) 15:27, 10 November 2022 (UTC)[reply]Please remove {{pp-template}} (which is redundant to {{Rcat shell}}) and replace {{R from alternative spelling}} with {{R from British English}}. Thank you, [reply]