Bản mẫu:Navbox subgroup

Trang bản mẫu bị khóa vô hạn
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 này được thiết kế để sử dụng với {{Navbox}} hoặc bất kì bản mẫu điều hướng khác cho phép tạo danh sách các liên kết với các tiêu đề nhóm hoặc tiêu đề. Bản mẫu này cho phép tạo tối đa 20 nhóm con có thể được chỉ định cho một mục danh sách trong {{Navbox}}. Đối với 20 nhóm con trở xuống, mẫu này có chức năng tương đương với {{Navbox|subgroup}}, nhưng kém hiệu quả hơn vì nó sử dụng một lớp bản mẫu bổ sung. Do đó, nên sử dụng {{Navbox|subgroup}} thay thế.

Tham số mẫu

{{Navbox subgroup
| groupstyle = 
| liststyle  = 

| group1 = 
| list1  = 
| group2 = 
| list2  = 
...
| group20 = 
| list20  = 
}}

Các tham số

Bản mẫu này sử dụng tất cả các tham số của {{Navbox}}. Xin vui lòng xem tài liệu ở đó để mô tả đầy đủ hơn. Trong thực tế, sự khác biệt duy nhất giữa mẫu này và {{Navbox}} như sau:

  • Tham số viền mặc định là "child"
  • Việc đệm nhóm mặc định thành 0,75em ở bên trái/phải và chỉ có thể được thay đổi với tham số grouppadding. Điều này được thực hiện để ngăn lỗi mô hình hộp Internet Explorer ảnh hưởng đến độ rộng của các nhóm.

Mọi thứ khác là chính xác giống như {{Navbox}}.

Chỉ các thông số phổ biến nhất được liệt kê dưới đây.

Ô

listn
(i.e. list1, list2, ... list20) The body of the template, usually a list of links. Format is inline. At least one list parameter is required; each additional list is displayed in a separate row of the table. Each listn may be preceded by a corresponding groupn parameter, if provided (see below).
groupn
(i.e. group1, group2, ..., group20) If specified, text appears in a header cell displayed to the left of listn. If omitted, listn uses the full width of the table. The background color defaults to #e6e6ff, but can be changed via the groupstyle parameter (see below).

Kiểu dáng

bodystyle
Specifies CSS styles to apply to the template body. Examples:
background:#nnnnnn;
text-align:[right/center/left/justified];
groupstyle
CSS styles to apply to the groupn cells. This option overrides any styles that are applied to the entire table. Examples:
background:#nnnnnn;
text-align:[left/center/right];
vertical-align:[top/middle/bottom];
white-space:nowrap;
grouppadding
CSS style to specify group padding. Should usually be specified using em units. It is recommended to leave this parameter alone and use the default padding. Examples:
grouppadding = 0em 1em; (1em on left/right, 0em on top/bottom)
grouppadding = 0em 0.5em 0em 1em; (0em top, 0.5em right, 0em bottom, 1em left)
liststyle
CSS styles to apply to all lists. Overridden by the oddstyle and evenstyle parameters (if specified) below.
oddstyle
evenstyle
CSS styles to apply to the odd-numbered list items (list1, list3, etc) or even-numbered list items (list2, list4, etc), respectively. Typically used to set background color (background:#nnnnnn;) in order to achieve an alternating background color between odd and even-numbered lists.
evenodd [swap, even, odd, off]
If set to swap, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting to even or odd sets all rows to have that striping color. Setting to off disables automatic row striping. NOTE: Due to system limitations, do not use a semi-colon to close this command.

Đặt độ rộng của các nhóm

Nếu có nhiều {{Navbox subgroup}} được sử dụng bên trong {{Navbox}}, nhìn chung sẽ đẹp hơn nếu chiều rộng của các nhóm khớp với nhau. Để làm điều này, người ta phải đặt tham số groupwidth:

groupwidth = 10em

Một cách khác là đặt tham số groupstyle để chứa chiều rộng mong muốn và tham số liststyle để là width:auto (do HTML/CSS). Ví dụ, đặt mã sau vào mỗi {{Navbox subgroup}} để điều chỉnh độ rộng:

groupstyle = width:10em;
liststyle = width:auto;
  • CHÚ Ý: For the groupstyle widths to work, you must set the liststyle width to "auto".

If you also use the image or imageleft parameters, then you will most likely also need to set their width manually using the imagestyle and imageleftstyle parameters.

Example

The following is an example of Navbox subgroup used within a Navbox template.

{{Navbox
| state  = uncollapsed
| name   = Protected Areas of Colorado
| title  = Protected Areas of Colorado
| listclass = hlist
| group1 = National Park Service
| list1  = {{Navbox subgroup
  | group1 = National Parks
  | list1  =
*[[Black Canyon of the Gunnison National Park|Black Canyon of the Gunnison]]
*[[Great Sand Dunes National Park and Preserve|Great Sand Dunes]]
*[[Mesa Verde National Park|Mesa Verde]]
*[[Rocky Mountain National Park|Rocky Mountain]]
  | group2 = National Monuments
  | list2  =
*[[Colorado National Monument|Colorado]]
*[[Florissant Fossil Beds National Monument|Florissant Fossil Beds]]
*[[Hovenweep National Monument|Hovenweep]]
*[[Yucca House National Monument|Yucca House]]
  | group3 = National Historic Sites
  | list3  =
*[[Bent's Old Fort National Historic Site|Bent's Old Fort]]
*[[Sand Creek Massacre National Historic Site|Sand Creek Massacre]]
  | group4 = National Recreation Area
  | list4  =
*[[Curecanti National Recreation Area|Curecanti]]
  }}
| group2 = National Forests
| list2  =
*[[Arapaho National Forest|Arapaho]]
*[[Grand Mesa National Forest|Grand Mesa]]
*[[Gunnison National Forest|Gunnison]]
*[[Pike National Forest|Pike]]
*[[Rio Grande National Forest|Rio Grande]]
*[[Roosevelt National Forest|Roosevelt]]
*[[Medicine Bow - Routt National Forest|Medicine Bow - Routt]]
*[[San Isabel National Forest|San Isabel]]
*[[San Juan National Forest|San Juan]]
*[[Uncompahgre National Forest|Uncompahgre]]
*[[White River National Forest|White River]]
}}

Xem thêm

  • {{Navbox}} – Hộp diều hướng cơ bản
  • {{Navbox with columns}} – Cho phép các cột thay vì nhóm / danh sách
  • {{Navbox with collapsible groups}} – Một biến thể khác.
  • Wikipedia:Line-break handling – The how-to guide about how to handle word wraps (line breaks) on Wikipedia, such as the wrapping of the link lists used in navboxes. Deprecated; use the hlist class.
  • {{Nowrap begin}} – The recommended format for adding bullets, pipes, or dashes between list items. Deprecated; use the hlist class.
  • {{Nobold}} – To display text at normal font-weight within a context where the default font-weight is bold, e.g. header cells in tables.
So sánh các bản mẫu điều hướng
Bản mẫu Đóng mở Màu tiêu đề Hình Nhóm Tham số
style (body)
{{Hộp điều hướng}} collapsible navbox Trái/phải nội dung
{{Navbox with collapsible groups}} collapsible navbox Trái/phải nội dung và/hoặc
trong mỗi danh sách
{{Navbox with columns}} collapsible navbox Trái/phải các cột Không
Thuộc tính collapsible
Kiểu Lớp CSS JavaScript Đóng khi Tùy chỉnh
trạng thái ban đầu
Lồng vào nhau
Bảng đóng mở mw-collapsible Định nghĩa trong Common.js 2 hoặc nhiều hộp autocollapse trong trang