Bản mẫu:Collapse

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]

Bản mẫu Collapse được sử dụng để đặt các hộp thu gọn xung quanh các nội dung ngắn và các đoạn thảo luận (bảng, mẫu mã dài, v.v.). Đối với toàn bộ nội dung, hãy sử dụng {{Collapse top}} và {{Collapse bottom}}.

Sử dụng[sửa mã nguồn]

{{Collapse|1=Discussion text to be put into box.|2=Optional custom heading}}

Để chắc chắn an toàn nhất, nên sử dụng |1=|2= , vì nếu không thì bản mẫu có thể bị phá vỡ nếu có bất kỳ ký tự "=" nào.

Tham số bg[sửa mã nguồn]

Tham số bg là tùy chọn. Nó thay đổi màu nền, sử dụng các giá trị màu web (ví dụ:#F0F2F5).

Ví dụ

{{Collapse|1=Discussion text to be put into box.|bg=#F0F2F5}} tạo ra:

Tham số padding[sửa mã nguồn]

Tham số padding điều chỉnh độ rộng ô nội dung (mặc định là 8px):

{{Collapse|1=Discussion text to be put into box.|padding=20px}} tạo ra:

Xung quanh văn bản tiêu đề[sửa mã nguồn]

Khi được sử dụng với một phần văn bản, hãy bao gồm tiêu đề phần đó trong phần văn bản được thu gọn. Ví dụ, cho:

Thay bằng:

Tham số expand[sửa mã nguồn]

Thêm |expand=yes để hộp hiển thị ở dạng mở rộng với liên kết "ẩn", thay vì ở dạng thu gọn với liên kết "hiện". Dùng |expand= có giá trị trống hoặc không dùng tham số expand sẽ để hộp hiển thị ở dạng thu gọn.

Tham số float[sửa mã nguồn]

Thsm số float cho phép nội dung thu gọn nổi sang trái, phải hoặc giữa trang (mặc định là none với width = 100%):

{{Collapse|1=Discussion text to be put into box.|float=center}} tạo ra:

{{Collapse|1=Discussion text to be put into box.|float=center|width=30em}} tạo ra:

{{Collapse|1=Discussion text to be put into box.|float=left|width=30em}} tạo ra:

{{Collapse|1=Discussion text to be put into box.|float=right|width=30em}} tạo ra:

{{Collapse|1=Discussion text to be put into box.|float=none|width=30em}} tạo ra:

Tham số clear[sửa mã nguồn]

Trong một số trường hợp, bạn có thể không muốn áp dụng giá trị CSS mặc định clear: both;, điều này sẽ đặt hộp thu gọn bên dưới bất kỳ nội dung nổi bên trái hoặc bên phải nào trong cùng một khối HTML. Trong trường hợp này, bạn có thể sử dụng|clear=none, |clear=right, or |clear=left, as needed.

Khi nội dung bao gồm các bảng[sửa mã nguồn]

Bản mẫu này thường bị hỏng khi được sử dụng xung quanh nội dung bao gồm hoặc bao gồm wikitable. Nội dung như vậy có thể được thu gọn bằng cách sử dụng {{collapse top}}{{collapse bottom}} thay vì dùng {{collapse}}.

TemplateData[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 Collapse

Creates a collapsible box that allows its content to be hidden or revealed on user's command. It is used to reduce clutter.

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
Contents1 content text

Contents of the box

Nội dungbắt buộc
Title2 title heading header reason result

Text of title bar. Defaults to "Extended contents".

Mặc định
Extended content
Chuỗi dàikhuyên dùng
Expanded by default?expand

Setting to "yes" (or "y", "expand", "expanded", "uncollapse", or "uncollapsed") will cause the box to show its contents by default. Any other value (and omitting this parameter) causes the box to be expanded by default. If not set or set to another value (e.g. "no") the box will be collapsed by default (its contents hidden).

Mặc định
no
Chuỗi dàitùy chọn
Border widthborder

Width of the outermost border. Accepts a number (e.g. 2) followed immediately with a CSS-compatible unit of measurement. (e.g. "px") Example: 2px.

Mặc định
1px
Chuỗi dàitùy chọn
Title bar's colorbg background

Color of the title bar. Can be set any valid CSS color value but please take care that text would remain black.

Mặc định
#F0F2F5
Chuỗi dàitùy chọn
Paddingpadding

Width of the padding, the empty space between border and the contents. Accepts a number (e.g. 2) followed immediately with a CSS-compatible unit of measurement. (e.g. "px") Example: 2px.

Mặc định
8px
Không rõtùy chọn
Outer backgroundbg1

Color of the space between the inner and outer border. Can be set to any valid CSS color.

Mặc định
transparent
Chuỗi dàitùy chọn
Outer border colorb-color

Color of the outer border. Can be any valid CSS color.

Mặc định
silver
Chuỗi dàitùy chọn
Collapse box widthwidth

The width of the entire collapsed box.

Mặc định
100%
Chuỗi dàitùy chọn
Center-align titlecenter

If set to any value, the title will be centered.

Luận lýtùy chọn
Font colorfc

Font color for the title. Also sets the color of the [show]/[hide] link. Can be any valid CSS color

Chuỗi dàitùy chọn
CSS classclass

Additional CSS class to add

Chuỗi dàitùy chọn
CSS floatfloat

CSS float, one of "left", "right", "none", "center"/"centre", or blank.

Chuỗi dàitùy chọn
CSS clearclear

CSS clear value. The default depends on the selected float. Usually one of "none", "left", "right", or "both"

Chuỗi dàitùy chọn
Left-align titleleft

Left-aligns the title. Takes precedence over center.

Luận lýtùy chọn
Content borderborder2

CSS border styling to add to the content.

Mặc định
1px silver
Chuỗi dàitùy chọn
Content background colorbg2

Background color to use for expanded content.

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


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