Template:Hidden begin
表示
| このテンプレートは3,000以上のページで使われています。 余計な混乱やサーバーへの負荷を避けるために、どんな変更でも最初はテンプレートのサンドボックス・サブページ、テストケース・サブページもしくはあなた自身の利用者スペースのページで試すべきです。そうすれば、試した変更を1度の編集でこのテンプレートに加えることができます。しかし、最初にあなたの提案した変更を、この項目のノートで議論するようにお願いします。 |
折り畳み機能はしばしば不適切な使用例や問題点が指摘されており、使わずに済めば越したことはありません。本当に折り畳みの使用が適切かどうか、また他の機能で代用できないか、ご使用の前に確認してみてください。
|
{{Hidden begin}}と{{Hidden end}}を組み合わせて使います。
パラメータ
| 適用先 | パラメータ | 説明文 |
|---|---|---|
| 全体 | showhide | タイトルバーにおける[表示/隠す]の位置。デフォルトでは右側に、leftと指定するとタイトルバーの左側に置かれます。内部では後述のCSS クラスに mw-collapsible-leftside-toggleという値を反映させます。
|
| toggle | showhideと同じ。併記不可。 | |
| expanded | 初期状態で表示するか隠すかを決めます。デフォルトでは隠し、任意の値で表示します。 内部では後述のCSS クラスに mw-collapsedという値を反映させます。
| |
| class | CSS クラスの指定。 CSS クラスには固定で mw-collapsibleが設定されており、次いで前述のshowhideとexpandedが反映され、最後にこの値が設定されます。floatleftなどの選択があります。ダブルクォーテーションで囲んでよいです。 | |
| width | 幅を指定します。 CSSの widthの値になります。デフォルトでは 100%です。
| |
| border | ボーダーのCSSの指定。 CSSの borderの値になります。省略時には noneが設定されます。
| |
| style | CSSの指定。 CSSには固定で box-sizing:border-box; font-size:95%; padding:4px;が設定されており、次いで前述のwidthとborderが反映され、最後にこの値が設定されます。ダブルクォーテーションで囲んでよいです。 | |
| タイトルバー | header | タイトルバーに表示するテキスト。 |
| title | headerと同じ。併記すると、headerが先に表示されます。ダブルクォーテーションで囲んでよいです。 | |
| titlestyle | タイトルバーに適用されるCSS属性。 CSSには固定で font-size:100%;line-height:1.6;font-weight:bold;が設定されており、次いで、後述のbg1、ta1、extra1が順に反映され、最後にこの値が設定されます。ダブルクォーテーションで囲んでよいです。 | |
| headercss | titlestyleと同じ。併記不可。 | |
| bg1 | タイトルバーの背景色。 指定すると、CSSの backgroundが設定されます。ダークモードへの配慮が必要です。 | |
| ta1 | タイトルバーの文字配置。標準はleft。 CSSの text-alignの値になります。
| |
| extra1 | タイトルバーのCSS属性。 | |
| 中身 | contentstyle | 中身に適用されるCSS属性。 CSSには固定で設定される値はなく、後述のbg2、ta2、extra2が順に反映され、最後にこの値が設定されます。 |
| bodystyle | contentstyleと同じ。併記不可。 | |
| contentcss | contentstyleと同じ。併記不可。 | |
| bg2 | 中身の背景色。 指定すると、CSSの backgroundが設定されます。ダークモードへの配慮が必要です。 | |
| ta2 | 中身の文字位置。 デフォルトはleft。CSSの text-alignの値になります。
| |
| extra2 | 中身のCSS属性。 |
使用例
| コード | 表示 |
|---|---|
{{hidden begin
|title = default example
}}
*def
*ghi
{{hidden end}}
|
default example
|
{{hidden begin
|title = title with background:pink
|titlestyle = background:pink;
}}
*def
*ghi
{{hidden end}}
|
title with background:pink
|
{{hidden begin
|title = title aligned in the center
|titlestyle = background:pink; text-align:center;
}}
*def
*ghi{{hidden end}}
|
title aligned in the center
|
{{hidden begin
|title = title aligned on the right needs padding-right
|titlestyle = background:pink;
text-align:right;padding-right:3em;
}}
*change window width and
*watch title alignment{{hidden end}}
|
title aligned on the right needs padding-right
|
{{hidden begin
|toggle = left
|title = title with toggle=left
|titlestyle = background:palegreen;
}}
*def
*ghi
{{hidden end}}
|
title with toggle=left
|
{{hidden begin
|toggle = right
|title = title with toggle=right
|titlestyle = background:lightgrey;
}}
*def
*ghi
{{hidden end}}
|
title with toggle=right
|
{{hidden begin
|toggle = left
|title = abc with toggle=left
|titlestyle = background:palegreen;
|bodystyle = font-size:150%; font-weight:bold;
}}
*def
*ghi
{{hidden end}}
|
abc with toggle=left
|
{{hidden begin
|toggle = right
|header = deprecated_header_
|title = title with toggle=right
|titlestyle = font-style:italic; padding-right:3em;
|border = dashed
|bg1 = palegreen
|bg2 = cyan
|ta1 = left
|ta2 = center
|extra1 = font-size:120%
|extra2 = font-size:150%
}}
*make window narrower and
*title will wrap
{{hidden end}}
|
deprecated_header_title with toggle=right
|
{{hidden begin
|toggle = right
|title = title with non-breaking spaces
|titlestyle =
|border = dotted
|bg1 = cyan
|bg2 = yellow
|ta1 = right
|ta2 = left
|extra1 = font-size:120%; padding-right:2.5em;
|extra2 = font-size:150%; padding-left:3em;
}}
*def these should have left padding
*ghi
{{hidden end}}
|
title with non-breaking spaces
|
関連項目
- {{Hidden}}
- {{Collapsible list}}