Predefinição Discussão:Expandir seção
Adicionar tópicoComo eu removo a margem esquerda?
[editar código-fonte]Nota: alguns editores da Wikipedia em inglês tentam ajudar com uma pergunta sobre esta predefinição. Por favor, desculpe o fato de que esta discussão é realizada em inglês. Alguns dos exemplos nas seções colapsadas não são exibidos corretamente aqui porque se referem a predefinições no en-wiki. | Note: some editors from English Wikipedia are trying to help out with a question about this template. Please excuse the fact that this discussion is held in English. Some of the examples in the collapsed sections do not display correctly here because they refer to templates on en-wiki. |
== How do I remove the left margin? ==
I want to remove the left margin in the Porutugese Wikipedia version of this template. In the source code, what makes the template touch the left border of the page? Thanks. --Bageense(disc.) 19:12, 5 August 2021 (UTC)
- User:Bageense: How do you want it? The same as it looks now, but in the middle of the page? Or larger like most other amboxes? If neither, please let me know exactly how you want it to look, and I'll try to write the required changes for you. In the below example, "style = margin: auto;" is what controls the horizontal alignment of the box.
In middle of page; same appearance otherwise
| ||
---|---|---|
Code {{SAFESUBST:<noinclude />#invoke:Unsubst||date=__DATE__ |$B= <!--{{Expand section}} begin-->{{Ambox | name = Expand section | type = content | small = {{{small|left}}} | style = margin: null; | image = [[File:Wiki letter w cropped.svg|{{#ifeq:{{{small|}}}|no|44px|20px}}|alt=[icon]]] | issue = This section '''needs expansion'''{{#if:{{{with|{{{for|{{{1|}}}}}}}}} | with: {{{with|{{{for|{{{1}}}}}}}}}}}{{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}} You can help by [{{fullurl:{{FULLPAGENAME}}|action=edit§ion={{{section|}}}}} adding to it].{{#if: {{{find|}}} | {{br}}{{find sources mainspace|{{{find|{{ARTICLENAME}} }}} | {{{find2|}}} }}|}} | talk = {{{talk|{{{discuss|{{{talksection|}}}}}}}}} | all = All articles to be expanded | cat = Articles to be expanded | date = {{{date|}}} }}<!--{{Expand section}} end--> }}<noinclude> {{Documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude> Appearance
|
Same appearance as other amboxes
|
---|
(This only requires adding the template to a page and passing the parameter Code {{Expand section|small=no}} Appearance Predefinição:Expand section |
- Also, if you want the box to be centred but small, I would recommend making the width of the box fit the text – doing so is an idea that I have had for all small left-aligned amboxes, and I am currently trying to get consensus for that change. Regards, DesertPipeline (talk) 16:15, 18 October 2021 (UTC)
- @DesertPipeline: Hello! What I want is neither of those options. I want to keep the small size, but remove the left margin altogether.
- style = margin: auto is responsible for the margin? How do we make it null? I tried "0" and "null" instead of auto and it didn't work. --Bageense(disc.) 04:34, 19 October 2021 (UTC)
margin:none
andmargin:null
are not valid declarations. For themargin
property, valid values are a length; a percentage; or certain keywords -auto
orinherit
. none and null are not among them. Some browsers may interpretmargin:none
as equivalent tomargin:0
but it should not be relied upon. --Redrose64 🌹 (talk) 08:21, 19 October 2021 (UTC)- User:Bageense: I'm not sure what you mean exactly; sorry. "Remov[ing] the left margin altogether", if I'm understanding correctly, isn't possible because with this type of code "margin" means "how far away from the edge a page element is". So with
margin-left: 0;
the element touches the left side of the page (usually – I'm simplifying here, because there are other pieces of code that might affect how this works). If you can explain what you mean by margin in this context, hopefully I'll be able to help. Sorry again for my confusion. Regards, DesertPipeline (talk) 15:23, 19 October 2021 (UTC)- @DesertPipeline: So with margin-left: 0; the element touches the left side of the page. Yes! That's precisely what I want. See the template again: it is touching the left side. In the corresponding template I created in the Portuguese wikipedia (link), it has that default space every normal-sized template has. Perhaps a percentage would work, like Redrose64 said. --Bageense(disc.) 17:01, 19 October 2021 (UTC)
- User:Bageense: I understand what you mean now. Add
| small = {{{small|left}}}
to the template in the same way this one has it – or whatever the Portuguese equivalent of that is. Regards, DesertPipeline (talk) 18:30, 19 October 2021 (UTC) - User:Bageense: Is the problem resolved now? DesertPipeline (talk) 16:13, 25 October 2021 (UTC)
- User:Bageense: I understand what you mean now. Add
- @DesertPipeline: So with margin-left: 0; the element touches the left side of the page. Yes! That's precisely what I want. See the template again: it is touching the left side. In the corresponding template I created in the Portuguese wikipedia (link), it has that default space every normal-sized template has. Perhaps a percentage would work, like Redrose64 said. --Bageense(disc.) 17:01, 19 October 2021 (UTC)
- Also, if you want the box to be centred but small, I would recommend making the width of the box fit the text – doing so is an idea that I have had for all small left-aligned amboxes, and I am currently trying to get consensus for that change. Regards, DesertPipeline (talk) 16:15, 18 October 2021 (UTC)
@DesertPipeline: Oh, hi! Before starting this discussion, I think I already tried adding the small parameter in the pt.wiki template. I didn't work, but anyway, the cause of the problem is there, not here. To be honest, I don't remember why I decided to start the discussion here and not there. Because it seems clear that the problem is actually there... --Bageense(disc.) 16:28, 25 October 2021 (UTC)
- User:Bageense: I see. I hope that you can get the problem resolved. One possible cause could be that they don't have the CSS code on that Wikipedia for small left-aligned message boxes; if it's not that, then I'm not sure what it could be. Regards, DesertPipeline (talk) 16:32, 25 October 2021 (UTC)
- @DesertPipeline: they do. I've been fiddling with this on pt-wiki in my common.css, to see if I could help, and independently noticed mbox-small-left as well. Defaults for these classes are:
.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;box-sizing:border-box;width:238px;font-size:88%;line-height:1.25em}
.mbox-small-left{margin:4px 1em 4px 0;box-sizing:border-box;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}
- Tried tweaking it before I saw your comment (as well as trying some other approaches afterward) and then again just now after you mentioned it, but so far no joy. The rendered table containing the Expand section box has classes "plainlinks metadata ambox mbox-small-left ambox-content" (see prettified excerpt in my pt sandbox) and I've been fiddling with those in my pt-wiki common.css. I can style the text inside by modifying the table cell containing the text, by adjusting the td class
mbox-text-span
in my css, but that doesn't touch the container. Fiddling with the table classes hasn't worked so far, and I've gone as far as I can afford at this point. This ought to be resolvable in common.css—we just haven't hit the right class or selector combo yet. Maybe you can figure something out from here. The Expand template is here: pt:Predefinição:Expandir seção. Cheers, Mathglot (talk) 19:52, 25 October 2021 (UTC) - @DesertPipeline, one other thing: I did add the
|small = {{{small|left}}}
to the pttemplatesandbox. I seem to remember, though, that I had an issue with 'small' in some other template (here at en-wiki) before, and tracked down the surprising result that|small=no
had precisely the same effect as|small=yes
(or any other param value); in fact, it was only checking whether the param was present and had a value, but I think that happened somewhere up the line. Not sure if that's equally true in this case. You can see the module defaults around l. 41-43 of the module config, and it's tested in en:Module:Message_box at l. 168-172; the small box class is added at l. 187. Not quite sure how it all interacts with the|small=
setting, but it's in there somewhere. Mathglot (talk) 22:26, 25 October 2021 (UTC)redacted by Mathglot (discussão) 00h29min de 26 de outubro de 2021 (UTC)
- @DesertPipeline: they do. I've been fiddling with this on pt-wiki in my common.css, to see if I could help, and independently noticed mbox-small-left as well. Defaults for these classes are:
Discussão copiada aqui desta seção em en-wiki. Mathglot (discussão) 00h07min de 26 de outubro de 2021 (UTC)
@Bageense e DesertPipeline: There's also a sandbox page now (here) containing the new code for param 'small'. I rediscovered the "small=no" equals "small=yes" thing, and there are testcases for it now here. Mathglot (discussão) 00h38min de 26 de outubro de 2021 (UTC)