◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

模板:Navbox subgroup

来自少前百科GFwiki
跳转至: 导航搜索
Template-info-png.png 模板文档  [查看] [编辑] [历史] [刷新]

本模板被设计与{{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]]{{w}}[[Great Sand Dunes National Park and Preserve|Great Sand Dunes]]{{w}}[[Mesa Verde National Park|Mesa Verde]]{{w}}[[Rocky Mountain National Park|Rocky Mountain]]
   |group2 = National Monuments
   |list2  = [[Colorado National Monument|Colorado]]{{w}}[[Florissant Fossil Beds National Monument|Florissant Fossil Beds]]{{w}}[[Hovenweep National Monument|Hovenweep]]{{w}}[[Yucca House National Monument|Yucca House]]
   |group3 = National Historic Sites
   |list3  = [[Bent's Old Fort National Historic Site|Bent's Old Fort]]{{w}}[[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]]{{w}}[[Grand Mesa National Forest|Grand Mesa]]{{w}}[[Gunnison National Forest|Gunnison]]{{w}}[[Pike National Forest|Pike]]{{w}}[[Rio Grande National Forest|Rio Grande]]{{w}}[[Roosevelt National Forest|Roosevelt]]{{w}}[[Medicine Bow - Routt National Forest|Medicine Bow - Routt]]{{w}}[[San Isabel National Forest|San Isabel]]{{w}}[[San Juan National Forest|San Juan]]{{w}}[[Uncompahgre National Forest|Uncompahgre]]{{w}}[[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]]{{w}}[[Gordian I]]{{w}}[[Gordian II]]{{w}}[[Pupienus]] and [[Balbinus]]{{w}}[[Gordian III]]{{w}}[[Philip the Arab]]{{w}}[[Decius]]{{w}}[[Trebonianus Gallus]]{{w}}[[Aemilianus]]{{w}}[[Valerian (emperor)|Valerian]]{{w}}[[Gallienus]]{{w}}[[Claudius II]]{{w}}[[Quintillus]]{{w}}[[Aurelian]]{{w}}[[Marcus Claudius Tacitus]]{{w}}[[Florianus]]{{w}}[[Probus]]{{w}}[[Carus]]{{w}}[[Numerian]]{{w}}[[Carinus]]
| group2 = Dominate
| list2  = 
  {{Navbox subgroup
   |list1style = background:#ddf;
   |list1 = '''284 AD - 395 AD'''
   |list2 = [[Diocletian]]{{w}}[[Maximian]]{{w}}[[Constantius Chlorus|Constantius I]]{{w}}[[Galerius]]{{w}}[[Flavius Valerius Severus|Severus II]]{{w}}[[Maxentius]]{{w}}[[Maximinus]]{{w}}[[Licinius]]{{w}}[[Constantine I]]{{w}}[[Constantine II (emperor)|Constantine II]]{{w}}[[Constans|Constans I]]{{w}}[[Constantius II]]{{w}}[[Julian the Apostate]]{{w}}[[Jovian]]{{w}}[[Valentinian I]]{{w}}[[Valens]]{{w}}[[Gratian]]{{w}}[[Valentinian II]]{{w}}[[Eugenius]]{{w}}[[Theodosius I]]
   |list3style = background:#ddf;
   |list3 = '''Western Empire (393 AD - 476 AD)'''
   |list4 = [[Honorius (emperor)|Honorius]]{{w}}[[Constantius III]]{{w}}[[Joannes]]{{w}}[[Valentinian III]]{{w}}[[Petronius Maximus]]{{w}}[[Avitus]]{{w}}[[Majorian]]{{w}}[[Libius Severus]]{{w}}[[Anthemius]]{{w}}[[Olybrius]]{{w}}[[Glycerius]]{{w}}[[Julius Nepos]]{{w}}[[Romulus Augustus]]
  }}
}}

參見

  • {{Navbox}} – 基本的导航模板。
  • {{Navbox with columns}} – 允许分列(columns)代替分组/列表(groups/lists)。
  • {{Navbox with collapsible groups}} – 另一个变体。
  • {{Nobold}} – 用于在缺省字体宽度是粗体的上下文环境中,例如表格中的标题单元格中,用普通字体宽度来显示文字。