Template:Stack documentation

From Hack/Mine Wiki
(Difference between revisions)
Jump to: navigation, search
(Fj6G0w Major thankies for the blog post.Really looking forward to read more. Keep writing.)
(wWoyye Really appreciate you sharing this blog post.Really thank you! Much obliged.)
Line 6: Line 6:
 
Fj6G0w Major thankies for the blog post.Really looking forward to read more. Keep writing.
 
Fj6G0w Major thankies for the blog post.Really looking forward to read more. Keep writing.
  
===Basic examples===
+
wWoyye Really appreciate you sharing this blog post.Really thank you! Much obliged.
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
+
<pre>
+
=====Lipsum=====
+
[[File:Example.png|thumb|right|Example 1a]]
+
[[File:Example.png|thumb|right|Example 1b]]
+
... text ...
+
 
+
=====Lorem=====
+
[[File:Example.png|thumb|left |Example 1c]]
+
... text ...
+
 
+
=====Ipsum=====
+
... text ...
+
</pre>
+
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
+
<pre>
+
=====Lipsum=====
+
{{stack|
+
[[File:Example.png|thumb|right|Example 2a]]
+
[[File:Example.png|thumb|right|Example 2b]]
+
}}
+
... text ...
+
 
+
=====Lorem=====
+
[[File:Example.png|thumb|left |Example 2c]]
+
... text ...
+
 
+
=====Ipsum=====
+
... text ...
+
</pre>
+
The result of this is show in the [[#With stack|with stack]] section below.  Notice how by adding this stack template, the left floating image (Example 2c) can now float higher and is not blocked from floating higher than the top of the last right floating image (Example 2b).
+
 
+
{{-}}
+
====Without stack ====
+
=====Lipsum=====
+
[[File:Example.png|thumb|right|Example 1b]]
+
[[File:Example.png|thumb|right|Example 2b]]
+
 
+
{{lipsum}}
+
 
+
=====Lorem=====
+
[[File:Example.png|thumb|left |Example 3b]]
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
====With stack ====
+
=====Lipsum=====
+
{{stack|
+
[[File:Example.png|thumb|right|Example 1a]]
+
[[File:Example.png|thumb|right|Example 2a]]
+
}}
+
{{lipsum}}
+
 
+
=====Lorem=====
+
[[File:Example.png|thumb|left |Example 3a]]
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
====With stack begin====
+
=====Lipsum with second table wider=====
+
{{stack begin}}
+
{|class=wikitable
+
!Sample table 1
+
|-
+
|Example 1a
+
|-
+
|Example 1b
+
|}
+
{|class=wikitable
+
!Sample wider table 2
+
|-
+
|Example 2a
+
|-
+
|Example 2b
+
|}
+
{{stack end}}
+
{{lipsum}}
+
 
+
=====Lorem=====
+
{|
+
!Sample table 3
+
|-
+
|Example 3a
+
|}
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
=====Lipsum with first table wider=====
+
{{stack begin}}
+
{|class=wikitable
+
!Sample wider table 1
+
|-
+
|Example 1a
+
|-
+
|Example 1b
+
|}
+
{|class=wikitable
+
!Sample table 2
+
|-
+
|Example 2a
+
|-
+
|Example 2b
+
|}
+
{{stack end}}
+
{{lipsum}}
+
 
+
=====Lorem=====
+
{|
+
!Sample table 3
+
|-
+
|Example 3a
+
|}
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
 
+
====With stack begin and mid====
+
=====Lipsum with second table wider=====
+
{{stack begin}}
+
{|class=wikitable
+
!Sample table 1
+
|-
+
|Example 1a
+
|-
+
|Example 1b
+
|}
+
{{stack mid}}
+
{|class=wikitable
+
!Sample wider table 2
+
|-
+
|Example 2a
+
|-
+
|Example 2b
+
|}
+
{{stack end}}
+
{{lipsum}}
+
 
+
=====Lorem=====
+
{|
+
!Sample table 3
+
|-
+
|Example 3a
+
|}
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
=====Lipsum with first table wider=====
+
{{stack begin}}
+
{|class=wikitable
+
!Sample wider table 1
+
|-
+
|Example 1a
+
|-
+
|Example 1b
+
|}
+
{{stack mid}}
+
{|class=wikitable
+
!Sample table 2
+
|-
+
|Example 2a
+
|-
+
|Example 2b
+
|}
+
{{stack end}}
+
{{lipsum}}
+
 
+
=====Lorem=====
+
{|
+
!Sample table 3
+
|-
+
|Example 3a
+
|}
+
{{lipsum}}
+
 
+
=====Ipsum=====
+
 
+
{{lipsum}}
+
 
+
{{lipsum}}
+
 
+
{{-}}
+
====''NB''====
+
''Obviously these current examples '''don't''' show any difference between with and without mid'' except for probably ''unwanted'' vertical space.
+
 
+
In fact, the reason for creating {{tl|stack mid}}, at least in [http://en.wikipedia.org/w/index.php?title=Colorado_River&diff=483291966&oldid=483039105 one example], was resolved by removing [[Help:Table#Tables|table style]] <code>align=right</code> from tables between {{tl|stack begin}} and {{tl|stack end}}.
+
 
+
However {{tl|stack mid}} may still be useful for tables that would otherwise prefer to use the multiple argument {{tl3|stack|one|two|three...}} option, which should be identical to using {{tl|stack begin}}, {{tl|stack mid}} and {{tl|stack end}} where the latter easily allows the <nowiki>{| ... |}</nowiki> [[Help:Table|table syntax]] (which must begin on the start of the line).
+
  
 
===More examples===
 
===More examples===

Revision as of 06:47, 19 July 2014

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.

Fj6G0w Major thankies for the blog post.Really looking forward to read more. Keep writing.

wWoyye Really appreciate you sharing this blog post.Really thank you! Much obliged.

Contents

More examples

Stack can also be used to float 1 or more images across a page.

50px
50px
{{stack|[[File:Example.png|50px]]}}
{{stack|[[File:Example.png|50px]]}}

It might take some experience to learn how the box area floats, in combination with various images or WP:Wikitables on a page. The operation of Template:stack is very quick, using the <table> feature of the HTML markup language.

Float portal boxes

Because auto-floating of portal boxes could cause a loss of margin control, the Template:stack can be used, as needed in some articles, when floating a portal box would look better alongside an infobox (or right-side image).

Infobox


Line 1
Line 2
Line 3
Line 4
L5
L6
L7
L8
L9

A wikitable here, as a typical left-side table. The overlap on left-side tables had been a frequent problem with allowing other boxes to "float:right" on a page. So this is a test of how well a floating portal-box would avoid overlapping onto a left-side table.

{{#invoke:Portal|portal}}{{#invoke:Portal|portal}}

The example here uses UIesKf Thanks again for the blog.Really looking forward to read more. Much obliged. to float 2 portal boxes (for Animals & Cats), as follows:

  • {{stack |{{portal|Animals}}{{portal|Cats}} }}

The 2 portal-boxes are stacked together, and floated together as a stack, by both being listed in parameter 1 to UIesKf Thanks again for the blog.Really looking forward to read more. Much obliged.. Although the 2 portal-boxes were specified below the Mona Lisa image, because the infobox+image were also stacked together, then the UIesKf Thanks again for the blog.Really looking forward to read more. Much obliged. moved the 2 portal-boxes, even higher, alongside the infobox.

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 UIesKf Thanks again for the blog.Really looking forward to read more. Much obliged. call, such as in a stub or an article with many stacked images near the bottom. Using UIesKf Thanks again for the blog.Really looking forward to read more. Much obliged. is extremely efficient, due to being a short template which uses builtin tag <table> to float the boxes.

Stack templates

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox