Bản mẫu:Div col

Bách khoa toàn thư mở Wikipedia
(Đổi hướng từ Bản mẫu:Palmares start)
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]
CSS3 multiple-column layout
browser support
Thuộc tính Internet
Explorer
Firefox Safari Chrome Opera
≤ 9 ≤ 1.0 ≤ 2 ≤ 11.0
column-width
column-count
≥ 10
(2012)
≥ 1.5
(2005)
≥ 3
(2007)
≥ 1
(2008)
≥ 11.1
(2011)
columns ≥ 10
(2012)
≥ 9
(2011)
≥ 3
(2007)
≥ 1
(2008)
≥ 11.1
(2011)
break-before
break-after
break-inside
≥ 10
(2012)
≥ 65
(2019)
≥ 10
(2016)
≥ 65
(2016)
≥ 15
(2013)

{{Div col}} formats a list into columns that wrap properly and compatibly with portable computer devices, especially PAD operating systems and small screens.

Mục đích[sửa mã nguồn]

It automatically breaks the available screen space into equal parts, meaning, for instance, that it is not necessary to guess how many columns to use and then figure out the dividing point(s), e.g., the halfway point to divide the list into two columns, or the one-third and two-thirds points to divide the list into three columns.

  • The list content is either provided by the |content= parameter (which can be restrictive of what content is allowed; e.g., wiki markup such as the | character must somehow be escaped), or terminated with {{div col end}}. The {{columns-list}} wrapper uses the parameter method for providing content (including its limitations).
  • The template system (family) also offers parameter options to set a smaller (90%) font-size parameter (|small=yes), place vertical lines parameter ("rules") between the columns (|rules=) and to add other custom styling (|style=).

{{Div col}} can create multiple columns in web browsers which support the following CSS properties:

Theo mặc định, bản mẫu tạo các cột rộng 30em.

Các tham số của bản mẫu này[sửa mã nguồn]

Miêu tả[sửa mã nguồn]

Có 6 tham số cho bản mẫu này:

|colwidth=
Specifies the minimum width of the columns so that the number of columns is automatically based on screen width (that is, more columns will be shown on wider displays). Can be specified in any CSS unit of measure, for instance, the em (about the width of the capital "M" of the displayed typeface), e.g., colwidth=20em. If no value is supplied, the template uses a default of 30em.
|rules=
Adds vertical lines ("rules") between the columns if set to yes or some CSS styling (e.g. 1px dashed blue;).
|gap=
Specifies the space between the content of adjacent columns. Specified in any CSS unit, e.g, gap=2em. The default spacing (set by browser) is 1em.
|style=
CSS styling to apply to the columns.
|small=yes
sets font size to 90%.
|content=
content to apply to the columns.

Ví dụ tham số "colwidth"[sửa mã nguồn]

Ví dụ có độ rộng cột là 10em
{{div col|colwidth=10em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

Ví dụ tham số "rules"[sửa mã nguồn]

Ví dụ
{{Div col|rules=yes}}
* a
* b
* c
* d
* e
* f
* g
* h
{{Div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

Ví dụ tham số "gap"[sửa mã nguồn]

Ví dụ
{{Div col|colwidth=10em|rules=yes|gap=2em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{Div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

Ví dụ tham số "small"[sửa mã nguồn]

Ví dụ cho thấy cách đặt tham số "small" thành "yes" tạo ra kích thước phông chữ nhỏ hơn
{{Div col|small=yes}}
* a
* b
* c
* d
* e
* f
* g
* h
{{Div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

Ví dụ tham số "content"[sửa mã nguồn]

Ví dụ cho thấy cách cung cấp tham số "content" mà không cần dùng {{Div col end}}
{{Div col|colwidth=10em|content=
* a
* b
* c
* d
* e
* f
* g
* h
}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

Cách sử dụng có nhiều tham số[sửa mã nguồn]

Các tham số có thể được sử dụng theo thứ tự bất kỳ. Ví dụ:

{{Div col|colwidth=10em|rules=yes|gap=2em|small=yes}}
* a
* b
* c
* d
* e
* f
* g
* h
{{Div col end}}

hoặc

{{Div col|rules=yes|gap=2em|small=yes|colwidth=10em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{Div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h

và chính xác cùng một kết quả dưới đây

  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
Ví dụ có độ rộng cột là 20em
{{div col|colwidth=20em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
Ví dụ có độ rộng cột là 30em
{{div col|colwidth=30em}}
* a
* b
* c
* d
* e
* f
* g
* h
{{div col end}}
kết quả
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
Ví dụ về cách cư xử bản mẫu này nếu không có bullets (được tạo ra bởi dấu hoa thị) được sử dụng.
{{div col|colwidth=10em}}
a
b
c
d
e
f
g
h
{{div col end}}
kết quả

a b c d e f g h

Thể loại theo dõi[sửa mã nguồn]

Dữ liệu bản mẫu[sửa mã nguồn]

Đâ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 Div col

Breaks a list into columns. It automatically breaks each column to an equal space, so you do not manually have to find the half way point on two columns. The list is provided by |content= or closed with {{div col 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
Column widthcolwidth

Specifies the width of columns, and determines dynamically the number of columns based on screen width; more columns will be shown on wider displays.

Ví dụ
30em
Chuỗi dàitùy chọn
Rulesrules

Produces vertical rules between the columns if set to yes.

Ví dụ
'yes' or '1px dashed blue'
Chuỗi dàitùy chọn
Gap sizegap

Specifies the space between the content of adjacent columns.

Ví dụ
2em
Chuỗi dàitùy chọn
CSS stylestyle

Specifies any custom styling.

Chuỗi dàitùy chọn
Contentcontent

Specifies the content to divide into columns

Chuỗi dàitùy chọn
Small fontsmall

Use a smaller font size (90%)

Mặc định
no
Ví dụ
yes
Chuỗi dàitùy chọn

Các trang đổi hướng[sửa mã nguồn]


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

Gia đình bản mẫu tạo ra cột[sửa mã nguồn]

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