Jump to content

Template talk:Center

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:Center/doc)

Edit request

[edit]

{{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]

 Done -- Mentifisto 19:28, 29 March 2009 (UTC)[reply]
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))[reply]
Can you test Template:Center/sandbox to see if it works as you intend? --fryed-peach (talk) 05:16, 2 April 2009 (UTC)[reply]
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))[reply]
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)[reply]
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))[reply]
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)[reply]

{{editprotected}} Admin, please copy Template:Center/sandbox to Template:Center. --fryed-peach (talk) 15:31, 4 April 2009 (UTC)[reply]

Done --Amalthea 16:43, 4 April 2009 (UTC)[reply]

Doc updates

[edit]

{{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

[edit]

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]

You probably mean without the margins. -- [[User:Edokter]] {{talk}} 00:18, 6 March 2015 (UTC)[reply]
I was just considering that. What would be your recommendation? Would it be better to add a new class? --  Gadget850 talk 00:49, 6 March 2015 (UTC)[reply]
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. -- [[User:Edokter]] {{talk}} 09:13, 6 March 2015 (UTC)[reply]
I'm thinking this should be used only to center a block of text. --  Gadget850 talk 09:21, 6 March 2015 (UTC)[reply]

Protected edit request on 18 March 2015

[edit]

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]

 Done. -- [[User:Edokter]] {{talk}} 16:15, 18 March 2015 (UTC)[reply]

Update to match left and right

[edit]

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)

Method 1
left text default text right text
Method 2
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]

since there are no objections, please update this template to this version of the sandbox. Frietjes (talk) 15:08, 12 October 2015 (UTC)[reply]
@Frietjes: 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)[reply]
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)[reply]
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? -- [[User:Edokter]] {{talk}} 19:16, 13 October 2015 (UTC)[reply]
User:Edokter, so what is your proposal? Frietjes (talk) 16:04, 8 November 2015 (UTC)[reply]
First we should define the desired functionality that does not have any ambiguity. -- [[User:Edokter]] {{talk}} 22:34, 8 November 2015 (UTC)[reply]
so only method 2? or only method 1? Frietjes (talk) 15:52, 21 November 2015 (UTC)[reply]

Learning how to center a template

[edit]

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]

Template-protected edit request on 3 May 2016

[edit]

Smarttechagra (talk) 07:17, 3 May 2016 (UTC)[reply]

Not done: Empty request — Andy W. (talk ·ctb) 07:55, 3 May 2016 (UTC)[reply]

Redundant styles?

[edit]

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]

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)[reply]
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)[reply]
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)[reply]

Template-protected edit request on 10 November 2022 - Tracking category

[edit]

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]

 Partly done: 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)[reply]
@Jonesey95: 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)[reply]
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)[reply]

Template-protected edit request on 8 April 2023

[edit]

Please remove {{pp-template}} (which is redundant to {{Rcat shell}}) and replace {{R from alternative spelling}} with {{R from British English}}. Thank you, {{ping|ClydeFranklin}} (t/c) 22:25, 8 April 2023 (UTC)[reply]

 Completed. P.I. Ellsworth , ed. put'er there 08:16, 9 April 2023 (UTC)[reply]