模板:Multicol-end

文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

用法 编辑

{{Multicol}} 可在頁面中做出分隔成多重欄位橫向排列的段落。在每個欄位的文字之間插入 {{Multicol-break}},並且在欄位最後以 {{Multicol-end}} 作為結尾。例如:

 {{Multicol}}
 第一欄位中的文字.
 {{Multicol-break}}
 第二欄位中的文字.
 {{Multicol-break}}
 第三欄位中的文字.
 {{Multicol-end}}

欄位的數量沒有上限。每一個欄位的寬度都會保持相同,依據頁面寬度平均分類。每一個欄位右方預留了最少 20 pixels 寬的間隔,以避免不同欄位的文字看著像是連在一起。See franl's user page for examples of how this template can be used.

Alternative templates 编辑

This template is only suitable when the content must be in exact columns and must always be side-by-side. This will cause the columns to be extremely narrow on small screens (a common phone size is around 23em across, which means a 2 column layout is only 11em per column and a 3 column layout less than 8em). If the exact break location is unimportant, use {{div col}}, which can automatically reduce column count on smaller screens. This is often more suitable for lists, where the exact line the new column starts is not important.

{{flex wrap centre}} is similar to this template in that the column break is fixed. However, that template will auto-wrap the "columns" into a vertical layout when the screen is too small to fit them side-by-side. This is often more suitable for images that appear side-by-side on paper.

參數 编辑

這個模板有4個可選填的參數

  • {{{width}}}, {{{1}}}: 整個欄位組的寬度和欄位彼此之間的間隔寬度 (use auto to shrink to content)
  • {{{align}}}: Alignment of the overall set of columns
  • {{{line}}}: Interstitial line format.
  • {{{gap}}}, {{{2}}}: The width of the gutter


Overall width 编辑

欄位組的整體寬度是 {{multicol}} 的第一个参数。可以是一個絕對值:例如 40em;也可以是依據整個頁面寬度而定的百分比,例如 50%。 This parameter defaults to 100%. For example, to create a multi-column section that is only 50% the width of the page:

{{Multicol|50%}}
This text appears in the first column.
{{Multicol-break}}
This text appears in the second column.
{{Multicol-break}}
This text appears in the third column.
{{Multicol-section}}
This text appears in the next row, first column.
{{Multicol-break}}
This text appears in the next row, second column.
{{Multicol-end}}

Alignment 编辑

多欄位的預設值是靠頁面左方。要改變對其方向,adjust the "align" parameter in {{multicol}} to "center" or "right"

 {{Multicol|50%|align=center}}
 ...
 {{Multicol-end}}

Margins 编辑

The margins can easily be changed by adjusting the second parameter in {{multicol}} or the first in {{multicol-break}}. You do not specify it in {{multicol-end}}. The margins occur on the left and right of the block, so you should specify half the actual separation you want.

{{Multicol||40px}}
This text appears in the first column.
{{Multicol-break|40px}}
This text appears in the second column.
{{Multicol-end}}

Line format 编辑

The third parameter controls a line between the blocks. This parameter is named "line" and cannot be accessed using positional arguments. It must be specified in {{multicol}} and {{multicol-break}}. The line format is given in the CSS way, eg "1px solid black", "2px dashed red", etc.

{{Multicol|line=1px solid black}}
This text appears in the first column.
{{Multicol-break|line=1px solid black}}
This text appears in the second column.
{{Multicol-end}}

Other style 编辑

the |style= parameter may be used to define other styles not covered above.

Technical notes 编辑

This template uses a table to achieve the columns. Consider using a table if it is clearer in context than using this template.

See also 编辑