模板: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 模板文檔,如果存在對應的同版本模板的話。