Template talk:Center

Edit request
editprotected

Please replace the current code with the below:

--fryed-peach (talk) 18:13, 29 March 2009 (UTC)
 * ✅ -- Menti  fisto  19:28, 29 March 2009 (UTC)


 * May somebody tell me what is the point of changing "align" to "class"? I'm just asking, because since that change has been made this template fucks up tables, so I'd rather see the edit undone. (Lord Gøn (talk) 01:12, 2 April 2009 (UTC))
 * Can you test Template:Center/sandbox to see if it works as you intend? --fryed-peach (talk) 05:16, 2 April 2009 (UTC)
 * Tested it, and it does not work as I intendead. The lines between the columns get messed up by using this template. (Lord Gøn (talk) 18:25, 2 April 2009 (UTC))
 * I have copied your test code to Template:Center/testcases. Could you elaborate how is it messed up? --fryed-peach (talk) 06:14, 3 April 2009 (UTC)
 * Well, the "Sandbox"-table looks fine, because there center/sandbox is used (whyever that makes a difference). Though in the "Original" the columns including the center-template (without the sandbox-add) move to the right. I really have a hard time to describe it. Isn't it visible for you? The lines confining the "center using"-columns overlap with the words in those columns not using it. It look really messed up and unpleasant. It should look like this: Column 1 | (center-template used here) Column 2 | Column 3 But by using this template it looks that way: Column 1 | (center-template used here) Column 2 C|olumn 3 (Lord Gøn (talk) 18:58, 3 April 2009 (UTC))
 * Thank your for testing. The problem is not visible in my usual browser, but I see it in some browsers. --fryed-peach (talk) 15:31, 4 April 2009 (UTC)

Admin, please copy Template:Center/sandbox to Template:Center. --fryed-peach (talk) 15:31, 4 April 2009 (UTC)
 * Yes check.svg Done -- Amalthea 16:43, 4 April 2009 (UTC)

Doc updates
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.

Class center
The template is currently defined as:

is defined in :

The problem with  alone is that it sets   which is often undesirable. The template overrides this with.

Seems to me this would be simpler as:



--  Gadget850talk 23:13, 5 March 2015 (UTC)


 * You probably mean without the margins.  00:18, 6 March 2015 (UTC)


 * I was just considering that. What would be your recommendation? Would it be better to add a new class? --  Gadget850talk 00:49, 6 March 2015 (UTC)


 * Depends what we want from this template; If we want to center a block, like left2 and right which uses float, then this template should not be changed. If however you only want just to center text inside a block, then there should only be text-align: center; . The whole naming is a bit inconsistent.  09:13, 6 March 2015 (UTC)


 * I'm thinking this should be used only to center a block of text. --  Gadget850talk 09:21, 6 March 2015 (UTC)

Protected edit request on 18 March 2015
please update to use the code in [//en.wikipedia.org/w/index.php?title=Template:Center/sandbox&oldid=651941715 this version of the sandbox], which is equivalent to making [//en.wikipedia.org/wiki/Special:ComparePages?page1=Template%3ACenter&rev1=342649230&page2=Template%3ACenter%2Fsandbox&rev2=651941715&action=&diffonly=&unhide= 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)


 * ✅.  16:15, 18 March 2015 (UTC)

Update to match left and right
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) I propose to update this template to [//en.wikipedia.org/w/index.php?title=Template:Center/sandbox&oldid=671412576 this version] which will make the syntax match and. 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)
 * since there are no objections, please update this template to [//en.wikipedia.org/w/index.php?title=Template:Center/sandbox&oldid=671412576 this version] of the sandbox. Frietjes (talk) 15:08, 12 October 2015 (UTC)
 * I don't know, the no-parameter usage looks like a pretty horrible hack to me. If this is used in wikitables, won't it stop them from being editable with VisualEditor? — Mr. Stradivarius  ♪ talk ♪ 10:27, 13 October 2015 (UTC)
 * User:Mr. Stradivarius, if this syntax breaks something, then someone should add tracking and clean up all uses with left/right. the proposal is for syntax consistency. Frietjes (talk) 14:16, 13 October 2015 (UTC)
 * The current code is horrid, so is the proposed code. Can't we decide first what it is supposed to do, then work from there, instead of the other way around?  19:16, 13 October 2015 (UTC)
 * User:Edokter, so what is your proposal? Frietjes (talk) 16:04, 8 November 2015 (UTC)
 * First we should define the desired functionality that does not have any ambiguity.  22:34, 8 November 2015 (UTC)
 * so only method 2? or only method 1? Frietjes (talk) 15:52, 21 November 2015 (UTC)

Learning how to center a template
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)

Template-protected edit request on 3 May 2016
Smarttechagra (talk) 07:17, 3 May 2016 (UTC)
 * Red information icon with gradient background.svg Not done: Empty request — Andy W. ( talk  · ctb) 07:55, 3 May 2016 (UTC)

Redundant styles?
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)
 * I'm not seeing the cases where this template doesn't centre text in mobile view. That goes for my phone, my tablet (both Chrome for Android), and my desktop when set to mobile view (with and without Ripple emulator; in Chrome, Firefox, Opera, IE11). I don't think that big banner is useful as it stands, unless we can be a bit more specific about where this template fails. --RexxS (talk) 21:11, 1 July 2018 (UTC)
 * I am also not seeing any failure to centre on mobile. Can we remove that warning on the doc page as it appears to be false? Hairy Dude (talk) 00:37, 20 March 2021 (UTC)
 * It appears that the warning about this not working in mobile is outdated. I have checked this in an iPhone and 2 Android mobiles in Chrome and Opera browsers, and it centers correctly in all of them. Based on this and the above two comments, I will remove it. ಮಲ್ನಾಡಾಚ್ ಕೊಂಕ್ಣೊ (talk) 15:20, 5 April 2022 (UTC)
 * It appears that the warning about this not working in mobile is outdated. I have checked this in an iPhone and 2 Android mobiles in Chrome and Opera browsers, and it centers correctly in all of them. Based on this and the above two comments, I will remove it. ಮಲ್ನಾಡಾಚ್ ಕೊಂಕ್ಣೊ (talk) 15:20, 5 April 2022 (UTC)

Template-protected edit request on 10 November 2022 - Tracking category
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  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)
 * I have added the standard unknown parameter tracking code instead. There is no reason to test only for 2. – Jonesey95 (talk) 15:27, 10 November 2022 (UTC)
 * Do you think you could remove the Main other check for the category? Being able to spot misuses in all namespaces would be preferable, as when this gets used wrong, chances are some (or all) content is getting completely voided, and having to hope it also falls under Category:Pages using center with no arguments isnt the best. Aidan9382 (talk) 21:22, 6 February 2023 (UTC)
 * I have done so. Editors should be judicious in modifying pages outside of article space that end up in this tracking category. Some errors may be deliberate. – Jonesey95 (talk) 21:24, 6 February 2023 (UTC)

Template-protected edit request on 8 April 2023
Please remove pp-template (which is redundant to Rcat shell) and replace R from alternative spelling with R from British English. Thank you,  { {ping&#124;ClydeFranklin }} (t/c) 22:25, 8 April 2023 (UTC)
 * ✅.  P.I. Ellsworth &thinsp;, ed.  put'er there 08:16, 9 April 2023 (UTC)