Bản mẫu:Multicol

(Đổi hướng từ Bản mẫu:MultiCol)
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]
{{Multicol|[overall width]|[gutter width]}} {{Multicol|[overall width]|[gutter width]}}
…… ……
{{Multicol-break}} {{Multicol-break}}
…… ……
{{Multicol-break}} {{Multicol-break}}
…… ……
(etc) (etc)
{{Multicol-end}} {{Multicol-end}}

Cách sử dụng sửa

{{Multicol}} is used to start a multi-columned section of a page. Between each column's contents, insert {{Multicol-break}} and close the last column with {{Multicol-end}}. For example:

<div style="background:lavender;">
{{Multicol}}
Các nội dung của cột thứ 1.
{{Multicol-break}}
Các nội dung của cột thứ 2.
{{Multicol-break}}
Các nội dung của cột thứ 3.
{{Multicol-end}}
</div>

…đưa ra:

Each column will be the same width (equally dividing the available horizontal space) and will include a small 20-pixel righthand margin (a "gutter") that prevents the contents in one column from touching those in the column to its right. (For further examples of how this template can be used, see User:franl's userpage.)

While it is technically possible to have many columns, accessibility implies that the use of any more than four or five should usually be avoided. If the number of items listed is fewer than six (e.g. fewer than two columns of three items), a column-based format is probably also best avoided.

Các tham số sửa

This template has two optional parameters: the overall width of the set of columns and the width of the gutter. The overall width of the set of columns can be an absolute value (e.g. 40em) or a percentage of the available page width (e.g. 50%). It defaults to 100%. The second parameter is the gutter used between columns (which, as mentioned above, defaults to 20px).

{{Multicol-break}} also takes an optional parameter for the gutter to its right, defaulting to 20px.

Ví dụ sửa

To create a three-column section, with four-pixel righthand gutters, that extends across 50% of the available width:

{{Multicol |50% |4px}}
Các nội dung của cột thứ 1.
{{Multicol-break |4px}}
Các nội dung của cột thứ 2.
{{Multicol-break |4px}}
Các nội dung của cột thứ 3.
{{Multicol-end}}

Kết quả:

A {{Multicol}}umned region is left-aligned with regard to the area of the page (the "block") it occupies. This may be switched to a centered or righthand alignment thus:

Bản mẫu được liên quan sửa

Layouts rendered by {{Multicol}} and accompanying templates may also be produced by {{Col-begin}} and its accompanying templates, but, depending on context and requirements, it may be easier to use one set rather than the other. Each of the following examples produce the same three-column table in which all columns have equal width:

These templates groups are not interchangeable. If you start with {{Multicol}}, but end with the plain {{col-end}} templates, then you'll have an unclosed <div> tag that can harm the formatting of the rest of the page. The problems created by mixing these templates is not easily visible for all users, so please don't assume that it's working properly just because it looks right for you. If you start with {{Multicol}}, then you must use {{Multicol-break}} and {{Multicol-end}}, not {{col-break}} and {{col-end}} (and vice versa).

Dữ liệu bản mẫu sửa

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho multicol

Starts a multi-column section. Subsequent columns are started by {{multicol-break}} and the section is ended with {{multicol-end}}

Tham số bản mẫu[Quản lý Dữ liệu bản mẫu]

Tham sốMiêu tảKiểuTrạng thái
Table width1

Width of table, a CSS width e.g. '50%'.

Mặc định
100%
Chuỗi dàitùy chọn
Column width2

Width of the first column.

Mặc định
20px
Chuỗi dàitùy chọn



Xem thêm sửa

Gia đình bản mẫu tạo ra cột sửa

Gia đình Loại
Xử lý mã
 bảng wiki?dagger
Bản mẫu bắt đầu Phân chia cột Bản mẫu kết thúc
"Col" Bảng {{Col-begin}},
{{Col-begin-fixed}} hoặc
{{Col-begin-small}}
{{Col-break}} hoặc
{{Col-2}} .. {{Col-5}}
{{Col-end}}
"Col-float" CSS float {{Col-float}} {{Col-float-break}} {{Col-float-end}}
"Columns" Bảng Không {{Columns}}
"Columns-list" Các cột CSS {{Columns-list}} (bao bọc)
"Columns-start" CSS float {{Columns-start}} {{Column}} {{Columns-end}}
"Div col" Các cột CSS {{Div col}} {{Div col end}}

dagger Tức là, các cột có thể xử lý đánh dấu wiki {| | || |- |} được sử dụng để tạo bảng? Nếu không, các mẫu tạo ra các phần tử này (chẳng hạn như {{(!}}, {{!}}, {{!!}}, {{!-}}, {{!)}}) và/hoặc thẻ HTML (<table>...</table>, <tr>...</tr>, v.v.) sẽ cần được sử dụng thay thế.