维库,知识与思想的自由文库
本模板是導航模板的應用之一,可以讓使用者快速建立一個含有連結清單的模板
[编辑] 使用方法
{{Navbox generic
|name = {{subst:PAGENAME}}
|title =
|titlebkg =
|image =
|style =
|group-style =
|state =
|top =
|group1 =
|list1 =
|group2 =
|list2 =
|group3 =
|list3 =
|group4 =
|list4 =
...
|group23 =
|list23 =
|bottom =
}}
[编辑] 參數
[编辑] 必填欄位
- name (或 templateName)
- 模板的名稱,使用於顯示模板導覽的連結。建議直接使用
{{subst:PAGENAME}}套入。
- title
- 標題名稱,會顯示在這個模板的最上面。
- listn
- 主要的清單內容,要表示的連結請置於此。需要注意的是每個項目之間請不要使用 「
|」,會對模板產生影響而導致之後的內容顯示不出來,可以用「-」或「.」代替。
[编辑] 選用欄位
[编辑] 元素
- groupn
- 清單的子標題。如不需要可省略不填
- image
- 在整個導覽欄的右邊加入圖片。請以標準型式加入([[Image:Example-zh.jpg|80px|right]]
)並注意尺寸。
- top
- (or above) A full-width cell displayed below the title and above the body (groups, lists and image). In a template without an image, top behaves like the list1 parameter without the group1 parameter.
- bottom
- (or below) A full-width cell displayed below the groups, lists and image. In a template without an image, bottom behaves like the template's final listn parameter without a groupn parameter. It is named bottom to match the parameter used in the former {{Navbox generic with image}} template. For an example of the bottom parameter in use, see {{Lists of the provinces and territories of Canada}}.
[编辑] 模板樣式
- titlebkg(或color)
- 標題欄位的背景顏色。預設以 #ccf 套入。不過當一個條目如果有一個以上的模板使用此模板時,設成不同的顏色可能會使讀者感到不適應。因此此參數需小心使用。
- style
- 對這個模板套入CSS參數.例如:
text-align: (right|center|left|justified); width: (em, %, px); float: (left|right|none); clear: (right|left|both|none); margin:...等等。須小心使用此參數,否則可能會造成視覺上的不協調。
-
- 注意:如果您需要用的width來指定模板的寬度,請不要使用auto,否則在模板折疊起來時,原本的寬度會跑掉。
- group-style
- 對模板的群組(即參數中的group)套入CSS參數。 本欄預設的背景顏色是
#ddf。
- top-style
- bottom-style
- Specifies CSS styles to apply to the top cell (specified via the top or above parameters) and bottom cell (specified via the bottom or below parameters). Typically used to set background color or text alignment:
background: #nnnnnn;
text-align: [left/center/right];
- odd-style
- even-style
- Specifies CSS styles to apply to the odd-numbered list items (list1, list3, etc.) and even-numbered list items (list2, list4, etc.). Typically used to set background color:
background: #nnnnnn;
[编辑] 其他
- state
- 設定模板的摺疊狀態。預設是自動摺疊(即autocollapse),也可設為強制摺疊(collapsed)或不摺疊(uncollapsed)。自動摺疊的定義是:當同樣設autocollapse的表格達一定數量時才會摺疊,否則會保持開放狀態(詳情請查詢MediaWiki:Common.js對autocollapse的設定。)
[编辑] 模板版面設計
以下這些表格是本模板現行的排版,您可以參考其結構調整參數,建立合適的清單模板。
|
{{{title}}} |
| {{{group1}}} |
{{{list1}}} |
| {{{group2}}} |
{{{list2}}} |
| {{{list3}}} (沒有 {{{group3}}} ) |
Table generated by {{
Navbox generic}}
with image, top and bottom parameters (borders added for illustration only):
|
{{{title}}} |
| {{{top}}} |
| {{{group1}}} |
{{{list1}}} |
{{{image}}} |
| {{{group2}}} |
{{{list2}}} |
| {{{list3}}} without {{{group3}}} |
| {{{bottom}}} |
[编辑] 範例
[编辑] 原始碼
{{Navbox generic
| name = Navbox generic/doc
| title = [[Wikipedia:導航模板|導航模板]]
| style = width:50%; text-align:left;
| image = [[Image:Example-zh.jpg|80px]]
| group1 = Physics
| list1 = [[Template:Cosmology|Cosmology]]{{·}} [[Template:General relativity|Relativity]]{{·}} [[Template:Quantum-theory|Quantum theory]]{{·}} [[Template:String-theory|String theory]]
| group2 = Continents
| list2 = [[Template:Continents of the world|World continents]]{{·}} [[Template:Africafooter|Africa]]{{·}} [[Template:Asiafooter|Asia]]{{·}} [[Template:Europefooter|Europe]]
| list3 = [[Template:National parks of Argentina|Argentinian National Parks]]
}}
[编辑] 結果
[编辑] 相關資訊
折疊屬性
| 類型 |
CSS Classes |
何時會折疊 |
Custom initial state |
Nesting |
Header color |
字體大小 |
| NavFrame div |
NavFrame, NavHead, NavContent |
3個或以上 |
否 |
是 |
#efefef |
95% |
| Collapsible table |
collapsible, navbox |
2個或以上 |
是 |
否 |
#ccccff |
90% |
|
For the technically minded, see Common.css and Common.js.
|