Content deleted Content added
No edit summary |
Jroberson108 (talk | contribs) →Floating portal boxes: Add clear instead of width & overflow to fix mobile portrait (Android). Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
(26 intermediate revisions by 16 users not shown) | |||
Line 1:
<noinclude>
{{ombox |text=This template serves as the shared documentation for {{tl|Stack}}, {{tl|Stack begin}},
</noinclude>
This template can be used to stack images and other floating content such as infobox templates without causing problems with spacing and floating. Enter a string of images/templates as the first parameter to have them stack without generating floating errors or spacing errors. You can stack many objects from the top of a section and not force further subsections to space out.
Line 9:
At its simplest:
<syntaxhighlight lang="wikitext">
{{stack|<objects>}}
</syntaxhighlight>
Alternatively, using {{tld|stack begin
<syntaxhighlight lang="wikitext">
{{stack begin}}
<
{{stack end}}
</syntaxhighlight>
===Optional parameters===
<syntaxhighlight lang="wikitext">
{{stack| <object(s)> | float=left or right | clear=true or false | margin=true or false}}
</syntaxhighlight>
or
<syntaxhighlight lang="wikitext">
{{stack begin | float=left or right | clear=true or false | margin=true or false}}
</syntaxhighlight>
where
*margin= ''true'' or ''false'' (default is '''false''')
*: This option can be used to add a 1em margin to the left (for float right) or right (for float left).
You can also
<syntaxhighlight lang="wikitext">
{{stack| float=left or right | clear=true or false | margin=true or false
}}
</syntaxhighlight>
*
== Examples ==
Line 49 ⟶ 52:
-->To illustrate the utility of the stack templates, consider the following situation. We would like to have two right floating images at the top of the first section of our article (here, the ''Lipsum'' section), and one left floating image at the top of the second section (here, the ''Lorem'' section). To achieve this layout, without using a stack template, we could try the following code:<!--
--><syntaxhighlight lang="wikitext">
=====''Lipsum''=====
[[File:
[[File:
... text ...
=====''Lorem''=====
[[File:
... text ...
=====''Ipsum''=====
... text ...
</
-->The result of this is shown in the ''[[#Without stack|without stack]]'' section below. Notice how the left floating image (Example 1c) is prevented from floating above the last right floating image (Example 1b). You may need to resize the width of your browser to fully appreciate the issue. To fix this problem, we can stack the two right floating images together, using the following code:<!--
--><syntaxhighlight lang="wikitext">
=====''Lipsum''=====
{{stack |[[File:
... text ...
=====''Lorem''=====
[[File:
... text ...
=====''Ipsum''=====
... text ...
</
-->The result of this is
{{clear}}
{{anchor|Without stack}}
====Without {{tlf|stack}}====
=====''Lipsum''=====
[[File:
[[File:
{{Str left|{{Lorem ipsum span}}|124}}
=====''Lorem''=====
[[File:
=====''Ipsum''=====
{{clear}}
Line 103 ⟶ 105:
----
=====''Lipsum''=====
{{stack|[[File:
{{Str left|{{Lorem ipsum span}}|124}}
=====''Lorem''=====
[[File:
=====''Ipsum''=====
{{clear}}
====With {{tlf|stack begin}} and {{tlf|stack end}}====
=====''Lipsum'' with second table wider=====
{{stack begin}}
Line 137 ⟶ 138:
|}
{{stack end}}
=====''Lorem''=====
Line 146 ⟶ 147:
|-
|}
=====''Ipsum''=====
{{clear}}
Line 173 ⟶ 174:
|}
{{stack end}}
=====''Lorem''=====
Line 182 ⟶ 183:
|-
|}
=====''Ipsum''=====
{{clear}}
===More examples===
{{tlf|Stack}} can also be used to float one or more images across a page.
{{stack |[[File:
{{stack |[[File:
<
{{stack|[[File:
{{stack|[[File:
</syntaxhighlight>
It might take some experience to learn how the box area floats, in combination with various images or [[WP:Wikitables|wikitables]] on a page. {{tlf|Stack}}'s operation is very quick, as it uses an [[HTML]] <table> to achieve its effects.
===Floating portal boxes===
{{tlf|Stack}} can be used to float a portal box beside an infobox (or other right-aligned item) when other methods might not work as anticipated.
{
|
[[File:Mona Lisa, by Leonardo da Vinci, from C2RMF retouched.jpg|thumb|right|60px|Test image]]
{| class="wikitable"
Line 298 ⟶ 213:
|}
{{stack |{{portal|Animals}}{{portal|Cats}}}}
The example here uses {{tld|stack}} to float two portal boxes (Animals, Cats) as follows:
{{clear}}<syntaxhighlight lang="wikitext">
{{stack |{{portal|Animals}}{{portal|Cats}} }}
</syntaxhighlight>
The two portal-boxes are stacked and floated together by both being listed as {{tld|stack}}'s (first) parameter. Because the infobox and image were also stacked together, {{tld|stack}} moved the two portal-boxes alongside the infobox despite
Normally, a portal-box would be stuck below the Mona Lisa image, causing this entire text section to format further below, and causing a large text-gap of empty whitespace to appear near the infobox. There is no limit to the number of portalboxes (or Commonscat boxes) which can be listed within a {{tld|stack}} call, such as in a stub or an article with many stacked images near the bottom. Using {{tld|stack}} is extremely efficient, due to being a short template which uses builtin tag <table> to float the boxes.
Line 309 ⟶ 225:
* {{tl|Stack}}
* {{tl|Stack begin}}
* {{tl|Stack end}}
== Tracking category ==
* {{clc|Pages using stack with unknown parameters}}
== See also ==
* {{tl|Multiple image}}, providing both vertical and horizontal layouts for multiple images.
* {{tl|Superimpose}}, which places one image over another.
* {{tl|Superimpose2}}, which can place up to fifty image layers over one another.
* [[Wikipedia:Extended image syntax#The many-floating-objects problem]]
<noinclude>
[[Category:
</noinclude>
|