Bản mẫu:Stack begin

Bách khoa toàn thư mở Wikipedia
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

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.

Cách sử dụng[sửa mã nguồn]

Tại nó đơn giản nhất:

{{stack|<objects>}}

Lựa chọn, cách sử dụng {{stack begin}}{{stack end}}:

{{stack begin}}
<objects>
{{stack end}}

The <object> may simply be a string of wikicode for many images/templates.

Các tham số tùy chọn[sửa mã nguồn]

{{stack| <objects> | float=left/right | clear=true/false}}

hoặc

{{stack begin | float=left/right | clear=true/false}}

where

  • float= left hoặc right (mặc định là right)
    This option can be used to float the stack to the left or right of the page
  • clear= true hoặc false (mặc định là false)
    This option can be used to force the stack to the far left or right (e.g., near an infobox).

You can also explicitly list multiple arguments:

{{stack| float=left/right | clear=true/false
|1=<object(s)>
|2=<object(s)>
|3=<object(s)>, etc. up to 9 parameters in the current version
}}
  • NB This multiple argument version does include extra vertical whitespace between each (set of) <object(s)>.

Các ví dụ[sửa mã nguồn]

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:
=====''Lipsum''=====
[[Tập tin:Simple shapes example.png|thumb|right|Ví dụ 1a]]
[[Tập tin:Simple shapes example.png|thumb|right|Ví dụ 1b]]
... chữ ...

=====''Lorem''=====
[[Tập tin:Simple shapes example.png|thumb|left|Ví dụ 1c]]
... chữ ...

=====''Ipsum''=====
... chữ ...
The result of this is shown in the without stack section below. Notice how the left floating image (Ví dụ 1c) is prevented from floating above the last right floating image (Ví dụ 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 |[[Tập tin:Simple shapes example.png|thumb|right|Ví dụ 2a]] [[Tập tin:Simple shapes example.png|thumb|right|Ví dụ 2b]]}}
... chữ ...

=====''Lorem''=====
[[Tập tin:Simple shapes example.png|thumb|left|Ví dụ 2c]]
... chữ ...

=====''Ipsum''=====
... chữ ...
The result of this is show in the with stack section below. Notice how by adding this stack template, the left floating image (Ví dụ 2c) can now float higher and is not blocked from floating higher than the top of the last right floating image (Ví dụ 2b).

Không có {{stack}}[sửa mã nguồn]

Lipsum[sửa mã nguồn]
Ví dụ 1a
Ví dụ 1b

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[sửa mã nguồn]
Ví dụ 1c

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[sửa mã nguồn]

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.

{{stack}}[sửa mã nguồn]


Lipsum[sửa mã nguồn]
Ví dụ 2a
Ví dụ 2b

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[sửa mã nguồn]
Ví dụ 2c

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[sửa mã nguồn]

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.

{{stack begin}}{{stack end}}[sửa mã nguồn]

Lipsum có bảng thứ hai rộng hơn[sửa mã nguồn]
Bảng mẫu 1
Ví dụ 1a
Ví dụ 1b
Mẫu bảng rộng 2
Ví dụ 2a
Ví dụ 2b

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[sửa mã nguồn]
Bảng mẫu 3
Ví dụ 3a

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[sửa mã nguồn]

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.

Lipsum có bảng thứ nhất rộng hơn[sửa mã nguồn]
Mẫu bảng rộng 1
Ví dụ 1a
Ví dụ 1b
Bảng mẫu 2
Ví dụ 2a
Ví dụ 2b

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[sửa mã nguồn]
Bảng mẫu 3
Ví dụ 3a

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[sửa mã nguồn]

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.

Các ví dụ nhiều hơn[sửa mã nguồn]

{{Stack}} can also be used to float one or more images across a page.

{{stack|[[Tập tin:Simple shapes example.png|80px]]}}
{{stack|[[Tập tin:Simple shapes example.png|120px]]}}

It might take some experience to learn how the box area floats, in combination with various images or wikitables on a page. {{Stack}}'s operation is very quick, as it uses an HTML <table> to achieve its effects.

Các hộp chủ đề Floating[sửa mã nguồn]

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

Hộp thông tin


dòng 1
dòng 2
dòng 3
dòng 4
dòng 5
dòng 6
dòng 7
dòng 8
dòng 9

Kiểm tra hình ảnh

This is a wikitable serving as a typical left-aligned table. The overlap on left-aligned tables had been a frequent problem when other boxes nearby were set to "float:right". 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 two portal boxes (Animals, Cats) as follows:

{{stack |{{chủ đề|Động vật}}{{chủ đề|Con mèo}} }}

The two portal-boxes are stacked and floated together by both being listed as {{stack}}'s (first) parameter. Because the infobox and image were also stacked together, {{stack}} moved the two portal-boxes alongside the infobox despite their being specified after the image.

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.

Gia đình bản mẫu Stack[sửa mã nguồn]

Xem thêm[sửa mã nguồn]

  • {{Double image}}, nơi đặt hình ảnh bên cạnh theo chiều ngang.
  • {{Multiple image}}, cung cấp cả hai bố cục theo chiều dọc và chiều ngang cho nhiều hình ảnh.
  • {{Superimpose}}, nơi đặt một hình ảnh khác hơn.
  • {{Superimpose2}}, nơi có thể đặt lên đến 50 lớp hình ảnh với nhau.