Template:Navbox subgroup

来自Arcaea中文维基
模板文档[查看] [编辑] [历史] [清除缓存]

本模板被设计与{{Navbox}}或其他共同使用,它们允许创建带分组抬头或标题的链接列表。这个模板允许创建子分组,整个子分组能被赋值作为{{Navbox}}内的一个列表项。一个子分组可以容纳最多22个列表项。

用法

{{Navbox subgroup
| groupstyle = 
| liststyle  = 

| group1 = 
| list1  = 
| group2 = 
| list2  = 
...
| group22 = 
| list22  = 
}}

参数说明

本模板的参数与{{Navbox}}的类似。

单元格

listn
(即list1list2、……list22)本模板的主体,通常是一些链接的一个列表。格式是内联(inline)。最少而言一个list参数是必需的。每个追加的list都会显示在表格的单独一行。每个listn可以以一个相应的groupn参数为先导,如果提供了的话(见下方)。列表项(以及整个表格)的背景颜色缺省为transparent,因而它显示与父导航框所用的相同的背景色。
groupn
(即group1group2、……group22)如果指定了的话,一个抬头单元格会显示在listn左侧,其中显现指定的文字。如果忽略了的话,listn会占用表格的全部宽度。背景颜色缺省为#ddf,但是能够通过groupstyle参数进行更改(见下方)。

样式

bodystyle
指定CSS样式,应用于模板主体。例如:
background:#nnnnnn;
text-align:[right/center/left/justified];
groupstyle
CSS样式,应用于groupn单元格。这个选项优先于任何应用到整个表格的样式。例如:
background:#nnnnnn;
text-align:[left/center/right];
vertical-align:[top/middle/bottom];
white-space:nowrap;
liststyle
CSS样式,应用于所有列表项。如果指定了oddstyleevenstyle参数的话(见下方),则会覆盖本参数。
oddstyle
evenstyle
CSS样式,分别应用于奇数编号列表项(list1list3等等)或偶数编号列表项(list2list4等等)。典型地被用来设定背景颜色(background:#nnnnnn;),以达到在奇数和偶数编号列表之间实现一个交互的背景颜色。

设置分组的宽度

若有多个{{Navbox subgroup}}模板被用在父级{{Navbox}}的内部,如果这些分组的宽度比较协调的话,通常看起来会更美观,为了做到这一点,使用者必须设定groupstyle参数来控制想要的宽度,以及设定liststyle参数来获得width:auto(由于HTML/CSS的原因)。例如,放置以下代码到每个{{Navbox subgroup}}中来调整宽度:

groupstyle = width:10em;
liststyle = width:auto;

举例

例1

下面是一个在Navbox模板内部使用Navbox subgroup的示例。

{{Navbox
| name   = Protected Areas of Colorado
| title  = Protected Areas of Colorado
| 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]]
}}

例2

这个示例实现了水平分组标题,方法是将标题分配到list1list3,将链接分配到list2list4,然后使用list1stylelist3style来设定标题的背景颜色。

{{Navbox
| name  = Roman Emperors
| title = Roman Emperors
| group1 = Crisis 235 AD - 284 AD
| list1  = [[Maximinus Thrax]]{{·}} [[Gordian I]]{{·}} [[Gordian II]]{{·}} [[Pupienus]] and [[Balbinus]]{{·}} [[Gordian III]]{{·}} [[Philip the Arab]]{{·}} [[Decius]]{{·}} [[Trebonianus Gallus]]{{·}} [[Aemilianus]]{{·}} [[Valerian (emperor)|Valerian]]{{·}} [[Gallienus]]{{·}} [[Claudius II]]{{·}} [[Quintillus]]{{·}} [[Aurelian]]{{·}} [[Marcus Claudius Tacitus]]{{·}} [[Florianus]]{{·}} [[Probus]]{{·}} [[Carus]]{{·}} [[Numerian]]{{·}} [[Carinus]]
| group2 = Dominate
| list2  = 
  {{Navbox subgroup
   |list1style = background:#ddf;
   |list1 = '''284 AD - 395 AD'''
   |list2 = [[Diocletian]]{{·}} [[Maximian]]{{·}} [[Constantius Chlorus|Constantius I]]{{·}} [[Galerius]]{{·}} [[Flavius Valerius Severus|Severus II]]{{·}} [[Maxentius]]{{·}} [[Maximinus]]{{·}} [[Licinius]]{{·}} [[Constantine I]]{{·}} [[Constantine II (emperor)|Constantine II]]{{·}} [[Constans|Constans I]]{{·}} [[Constantius II]]{{·}} [[Julian the Apostate]]{{·}} [[Jovian]]{{·}} [[Valentinian I]]{{·}} [[Valens]]{{·}} [[Gratian]]{{·}} [[Valentinian II]]{{·}} [[Eugenius]]{{·}} [[Theodosius I]]
   |list3style = background:#ddf;
   |list3 = '''Western Empire (393 AD - 476 AD)'''
   |list4 = [[Honorius (emperor)|Honorius]]{{·}} [[Constantius III]]{{·}} [[Joannes]]{{·}} [[Valentinian III]]{{·}} [[Petronius Maximus]]{{·}} [[Avitus]]{{·}} [[Majorian]]{{·}} [[Libius Severus]]{{·}} [[Anthemius]]{{·}} [[Olybrius]]{{·}} [[Glycerius]]{{·}} [[Julius Nepos]]{{·}} [[Romulus Augustus]]
  }}
}}

上述文档嵌入自Template:Navbox subgroup/doc(编辑 | 历史)
您还可以检视Rotaeno中文维基中该模板的subgroup 模板文档,如果存在对应的同版本模板的话。