Template:navbox generic

出典: Yourpedia

このテンプレートの解説はTemplate:navbox generic/docから呼び出されています[編集]
複雑な記述を使用しています このテンプレートの記述は複雑な構成となっております。編集後の結果が予想できない、または変更にともなう影響を修正する用意ができていない場合は編集をお控えください。練習や実験はサンドボックスやご自身の利用者ページサブページのスペースでお願いします。

このテンプレートは、ナビゲーション用のテンプレートの応用です。このテンプレートを使用することによって、テンプレート内にリストを形成することができます。

目次

[編集] フォーマット

{{Navbox generic
|name       = {{subst:PAGENAME}}
|state      = 
|titlestyle = background:
|title      = 
|image      = 
|bodystyle  =   <!--(もしくは "style =" ただしこれは、ほかのstyleパラメータを一切使用しない場合)-->
|groupstyle = 
|liststyle  = 
|oddstyle   = 
|evenstyle  = 

|abovestyle = 
|above      = 

|group1 = 
|list1  = 

|group2 = 
|list2  = 

|group3 = 
|list3  = 

 ...

|group20 = 
|list20  = 

|belowstyle = 
|below      = 
}}

[編集] パラメータ

[編集] 必須

name (または templateName)
テンプレートの名称です。テンプレートに表示される「表・話・編・履」のリンク先を適切に表示するために必要になります。{{subst:PAGENAME}} と入力すると簡単です。
title 
タイトルバーの部分に表示される文字列です。多くはテンプレートの主題、内容を総括した語が入ります。1行で書く必要がありますが、もし2行目が必要な場合は {{[[Template:{{{1}}}|{{{1}}}]]}} を使用してください。
背景色の初期値は #ccf#ccccff の短縮記法)になっています。後述する titlestyle パラメータで変更可能です。
listn
(i.e. list1, list2, etc.) テンプレートの本体で、ふつうはリンクのリストを記述します。書式はインラインですが、全体を <div> </div> で囲むことで複数行に分けて書くことができます。最低1つの list パラメータが必要で、追加の list はテーブル内の別の行として表示されます。必要であれば、それぞれの listn の直前に、対応する groupn パラメータを置くことができます(後述)。
リスト部およびテーブル全体の背景色は、初期値が #f9f9f9 になっています。後述する bodystyleoddstyle および evenstyle で変更可能です。

[編集] オプション

[編集] セル

groupn
(i.e. group1, group2, etc.) これが記述されると、listn とした部分の左に乱しセル画表示されます。省略すると、リスト部はテーブルの幅をすべて使って表示されます。
背景色の初期値は #ddf になっています。後述するgroupstyle パラメータで変更可能です。
image
画像を、タイトルの直下・リスト部の右側に表示します。正常に表示するためには list1 パラメータを指定しておく必要があります。このパラメータは普通に画像を表示する際の wiki テキストをそのまま使います(例: [[画像:Example.jpg|100px]]<code>)。
テンプレートを画面右端一杯まで表示しない場合、画像が右側にはみ出て表示されてしまいます。これを防ぐためには、画像の wiki テキストに right パラメータを指定してください(例: <code>[[画像:Example.jpg|80px|right]]<code>)。
above
(or top) 1行分のセルを、タイトルと最初のグループ・リスト部の間に表示します。画像を使わないテンプレートでは、 abovegroup1 を指定しない場合の list1 と同じような表示になります。
below
(or bottom) テンプレートの一番下に、1行分のセルを表示します。画像を使わないテンプレートでは、 below は最後の listn パラメータを groupn を使わずに表示した場合と同じような表示になります。below パラメータの使用例は en:Template:Lists of the provinces and territories of Canada をご覧ください。

[編集] テンプレートスタイル

titlestyle
(or title_style, titlebkg, color) CSS styles to apply to title, specifically the titlebar's background color. At present, use as follows:
<code>titlestyle = background:name or #nnnnnn
Use of this parameter is discouraged. Where it is used, care and consensus are needed as multiple navigational templates on one page with different background colors will probably look unpleasant.
bodystyle もしくは style
Specifies CSS styles to apply to the template body. The shorter name style may be used when no other style parameters are specified. This option should be used sparingly as it can lead to visual inconsistencies. Examples:
background:#nnnnnn;
text-align:[right/center/left/justified];
width:N [em/%/px or width:auto];
float:[left/right/none];
clear:[right/left/both/none];
groupstyle
(or group_style, group-style) 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;
abovestyle
belowstyle
(or above_style, top-style; below_style, bottom-style) CSS styles to apply to the top cell (specified via the above parameter) and bottom cell (specified via the below parameter). Typically used to set background color or text alignment:
background:#nnnnnn;
text-align:[left/center/right];
liststyle
CSS styles to apply to all lists. Overruled by the oddstyle and evenstyle parameters (if specified) below.
oddstyle
evenstyle
(or odd-style, even-style) 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; see {{Turkey-related topics}} for an example.

[編集] その他

state
デフォルトは autocollapse です。これを collapsed にすると、最初は必ず折りたたまれた状態で表示されます。空白を指定するか、 autocollapsecollapsed 以外の値を指定すると、最初は展開された状態で表示されます。autocollapse を指定すると、ページ内に2つかそれ以上の collapsible クラスを使用したテーブルがある場合には折りたたまれた状態で表示され、1つの場合は展開されて表示されます。技術的なことについてはMediaWiki:Common.jsを参照。
To specify different states for transcluding articles, set state to {{{state|autocollapse}}}. Then, in an article, set this parameter to a value described above. For example, {{templateName|state=}} will expand the template.

[編集] レイアウト

[編集] 表示例

[編集] コード

{{navbox generic
|name=家庭用ゲーム機メーカ
|title=[[コンシューマーゲーム|家庭用ゲーム機メーカ]]
|style=text-align:left;
|group1=主要メーカ
|list1=[[任天堂]] - [[ソニー・コンピュータエンタテインメント]] - [[マイクロソフト]] - [[セガ]] - [[日本電気ホームエレクトロニクス|NECホームエレクトロニクス]]
|group2=その他メーカ
|list2=[[エポック社]] - [[バンダイ]] - [[SNK]] - [[アタリ (企業)|アタリ]]
}}

[編集] 本体

<tr> <th style="white-space:nowrap;">主要メーカ</th> <td style="" colspan="1">任天堂 - ソニー・コンピュータエンタテインメント - マイクロソフト - セガ - NECホームエレクトロニクス</td> </tr> <tr> <th style="white-space:nowrap;">その他メーカ</th> <td style="" colspan="1">エポック社 - バンダイ - SNK - アタリ</td> </tr>

[編集] 関連項目

ナビゲーションテンプレート対照

表示ノート編集履歴</div>

折畳モード タイトル色 画像 グループ スタイル
パラメータ
例テンプレート
{{Navigation}} NavFrame NavHead No No Yes {{Xプレーン}}
{{Navigation2}} NavFrame NavHead No Yes 部分 {{日本の高速道路}}
{{Navbox generic}} collapsible navbox Left and Right-hand side Yes Yes {{家庭用ゲーム機メーカ}}
{{NavigationBox}} No navbox Right of title+body No No {{日本の内閣}}
{{Commons:NavigationBox}} No #ccccff Right of title+body No No
{{Commons:Dynamic navigation box}} NavFrame #ccccff No No No
{{Commons:Dynamic navigation box with image}}  NavFrame #ccccff Upper left No No
The background color for the header or title is inherited from the class listed below. The templates have titlebkg parameters that override the default.
折畳属性
Type CSS classes Collapses when Custom
initial state
Nesting Header
color
Font size
NavFrame div NavFrame, NavHead, NavContent 3+ of the same No Yes #ccccff 95%
Collapsible table collapsible, navbox 2+ of the same Yes No #ccccff 90%

For the technically minded, see Common.css and Common.js.

姉妹サイト
他のサイトで同じ項目を探す