ढाँचा:Stack
![](http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
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.
Basic usage
[सम्पादन गर्नुहोस्]Using {{stack}}
,
{{stack|<objects>}}
or, alternatively, using {{stack begin}}
/{{stack end}}
{{stack begin}} <objects> {{stack end}}
Here, <objects>
is simply a string of wiki code for many images / templates.
Optional parameters
[सम्पादन गर्नुहोस्]{{stack| <objects> | float=left/right | clear=true/false}}
or
{{stack begin | float=left/right | clear=true/false}}
where
float=
left or right (default is right)- This option can be used to float the stack to the left or right of the page
clear=
true or false (default is false)- This option can be used to force the stack to the far left or right (e.g., near an infobox).
Basic examples
[सम्पादन गर्नुहोस्]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 acheive this layout, without using a stack template, we could try the following code
=====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 ...
The result of this is shown in the 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
=====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 ...
The result of this is show in the 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
[सम्पादन गर्नुहोस्]![](http://upload.wikimedia.org/wikipedia/commons/7/70/Example.png)
![](http://upload.wikimedia.org/wikipedia/commons/7/70/Example.png)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem
[सम्पादन गर्नुहोस्]![](http://upload.wikimedia.org/wikipedia/commons/7/70/Example.png)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Ipsum
[सम्पादन गर्नुहोस्]Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
With stack
[सम्पादन गर्नुहोस्]Lipsum
[सम्पादन गर्नुहोस्]
![]() ![]() |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem
[सम्पादन गर्नुहोस्]![](http://upload.wikimedia.org/wikipedia/commons/7/70/Example.png)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Ipsum
[सम्पादन गर्नुहोस्]Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
More examples
[सम्पादन गर्नुहोस्]Stack can also be used to float 1 or more images across a page.
![]() |
![]() |
{{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
|
![](http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/60px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg)
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. |
The example here uses {{stack}}
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 {{stack}}
. Although the 2 portal-boxes were specified below the Mona Lisa image, because the infobox+image were also stacked together, then the {{stack}}
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 {{stack}}
call, such as in a stub or an article with many stacked images near the bottom. Using {{stack}}
is extremely efficient, due to being a short template which uses builtin tag <table> to float the boxes.
Stack templates
[सम्पादन गर्नुहोस्]- {{Stack}}
- {{Stack begin}}
- {{Stack end}}
See also
[सम्पादन गर्नुहोस्]- {{Double image}} places images side by side horizontally
- {{Multiple image}} allows both vertical and horizontal layouts
- {{Superimpose}}—places one image over another
- {{Superimpose2}}—places up to 50 image layers over one another