Template:Infobox/doc: Difference between revisions

From NeuroWiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Lua|Module:Infobox}}
{{Lua|Module:Infobox}}
本模板为一系列「信息框」模板的元模板,亦即本模板用于构建其他模板。通常不建議在条目中直接使用此模板,但是如有需要,可以在個別「一次性」情況中直接使用。参见[[Help:信息框]]以获取创建通用信息框的进一步方法。
This template serves as a meta-template for a series of "Infobox" templates, meaning it is used to build other templates. It is generally not recommended to use this template directly in articles, but it can be used in specific "one-off" situations if necessary. See [[Help:Infobox]] for further methods to create general infoboxes.


=== 用法 ===
=== Usage ===


本模板与{{tl|navbox}}的用法相似,但也有一些不同之处。表格中的每一行既可以是顶栏(header),也可以是成对的标签(label)与-{A|zh-hans:数据; zh-hant:資料;}-(data),甚至还可以只是一个数据单元。每行只能有一种状态,且具有优先级:当你将一行同时定义为顶栏与标签/数据对,那么标签/数据对的定义将会被忽略。
This template is similar in usage to {{tl|navbox}}, but there are some differences. Each line in the table can either be a header or a pair of label and data, or it can just be a single data cell. Each line can only have one state, with priority: if you define a line as both a header and a label/data pair, the label/data pair definition will be ignored.


====編號====
==== Numbering ====
為方便日後更改信息框格式,header和label/data行的編號不需要完全按照1、2、3……的加一順序編寫,可以在中間預留一些行編號不用,可避免將來如要增加新行時要把該行後面的行編號一併更改。
For ease of future changes to the infobox format, the numbering of header and label/data lines does not need to follow a strict order like 1, 2, 3, etc. You can leave gaps in the numbering to avoid renumbering all subsequent lines when adding new ones.


header和label/data行的編號不可以重複,例如不可以同時使用header1和label1/data1,請使用header1、label2/data2(舉例)。
Header and label/data lines must not be repeated; for example, you cannot use both header1 and label1/data1 at the same time. Use header1, label2/data2 instead (as an example).


如希望大量移動編號(如為加入新label需將所有之後的label數字加一),可考慮使用[[模块:IncrementParams]]
If you wish to renumber a large number of lines (such as when adding a new label requires incrementing all subsequent label numbers), consider using [[Module:IncrementParams]].


=== 参数 ===
=== Parameters ===


==== “查看/讨论/编辑/历史”链接 ====
==== "View/Discuss/Edit/History" Links ====
;name : “查看/讨论/编辑/历史”链接需要指向模板页的名称(name)。你可以填写<nowiki>{{subst:PAGENAME}}</nowiki>。如果此参数未填,则“查看/讨论/编辑/历史”链接不会显示。
;name: The "View/Discuss/Edit/History" links need to point to the name of the template page (name). You can use <nowiki>{{subst:PAGENAME}}</nowiki>. If this parameter is not filled, the "View/Discuss/Edit/History" links will not display.


==== 标题 ====
==== Title ====
{{Infobox
{{Infobox
|title = 信息框外的标题文本
|title = Text outside the infobox title
|data1 = (信息框的其余部分)
|data1 = (rest of the infobox)
}}
}}
{{Infobox
{{Infobox
|above = 信息框内的标题文本
|above = Text inside the infobox title
|data1 = (信息框的其余部分)
|data1 = (rest of the infobox)
}}
}}


有两种方式为一个信息框填入标题。一种是将标题填在信息框外,另一种则是填写在信息框内。根据需要,你可以选择其中的一种使用,亦或同时使用这两种标题,甚至都不使用(尽管我们不推荐这样做)。
There are two ways to add a title to an infobox. One is to place the title outside the infobox, and the other is to place it inside. You can choose either one based on your needs, use both, or even none at all (though we do not recommend the latter).
;title : 填写在信息框表格外顶部的标题文本。
;above : 填写在信息框表格内顶部单元的标题文本。


==== 可选项 ====
;title: Text for the title outside the infobox table top.
;subheader : 在 above 下面的次標題。subheader2是第2個次標題。
;above: Text for the title inside the infobox table top cell.
;image : 在模板上部显示的图像。请使用完整的图像语法,例如<nowiki>[[File:example.png|200px]]</nowiki>,推荐使用[[模块:InfoboxImage]]插入图像。图像的位置默认为居中。<br/>在中文維基百科,一個Infobox最多可使用4個圖像參數:overimage(置頂)、image(=image1)、image2、image3,與英文維基百科的Infobox僅提供image(=image1)、image2不同。
;caption : 位于图像下方的说明文本。<br/>overcaption、caption(=caption1)、caption2、caption3分別對應上面4個圖像參數。
;header(n) : 填入第n行的'''顶栏'''文本。
;label(n): 填入第n行的'''标签'''文本。
;data(n): 填入第n行的'''数据'''文本。
;below: 填写在信息框表格底部单元的文本。底部单元一般用来填写脚注、参见及其他类似的信息。


==== 可选的CSS风格 ====
==== Optional ====
;bodystyle : 应用到信息框表格全体。
;subheader: A subtitle below the above. Subheader2 is the second subtitle.
;titlestyle : 应用到信息框表格外的标题中。不建议在此处填写背景颜色(background color),因为该处的文字位于信息框外。
;image: An image displayed at the top of the template. Use full image syntax, such as <nowiki>[[File:example.png|200px]]</nowiki>. It is recommended to use [[Module:InfoboxImage]] to insert images. By default, images are centered.
;abovestyle : 应用到信息框表格内顶部单元中。默认的风格为“<syntaxhighlight lang="css" inline>font-size:large;</syntaxhighlight>”(字号设为大号),因为该单元常被用作标题。如果你希望让顶部单元以正常字号显示,只需在该处填写的内容中包含“<syntaxhighlight lang="css" inline>font-size:medium;</syntaxhighlight>”。
<br/>In the Chinese Wikipedia, an Infobox can use up to 4 image parameters: overimage (top), image (=image1), image2, image3, differing from the English Wikipedia Infobox which provides only image (=image1), image2.
;imagestyle : 应用到信息框的图像单元中,包括图像下方的说明文本。但是,出于兼容性与未来修改的考虑,如果你需要设置说明文本的属性,请使用captionstyle而不要使用imagestyle。
;caption: Caption text below the image.
;captionstyle : 应用到图像说明文本中。
<br/>Overcaption, caption (=caption1), caption2, caption3 correspond to the above 4 image parameters.
;headerstyle : 应用到所有的顶栏单元。
;header(n): Fill in the 'header' text for the nth line.
;header(n)style : 应用到第n行的顶栏单元。
;label(n): Fill in the 'label' text for the nth line.
;labelstyle : 应用到所有的标签单元。如果希望避免标签文字折行显示,只需在该处填写的内容中包含“<syntaxhighlight lang="css" inline>white-space:nowrap;</syntaxhighlight>”。或者例如“min-width: 4em;”。
;data(n): Fill in the 'data' text for the nth line.
;label(n)style : 应用到第n行的标签单元。
;below: Text in the bottom cell of the infobox table, often used for notes, see also, and similar information.
;datastyle : 应用到所有的数据单元。
;data(n)style : 应用到第n行的数据单元。
;belowstyle : 应用到底部单元中。


==== 微格式 ====
==== Optional CSS Styles ====
;bodyclass: 该参数影响信息框整体的类(class)。
;bodystyle: Applies to the entire infobox table.
;imageclass: 该参数影响图像的类。
;titlestyle: Applies to the title outside the infobox table. Background color is not recommended here as the text is outside the infobox.
;class(n): 该参数影响特定行数据单元的类。如果信息框没有数据单元,则不会产生作用。
;abovestyle: Applies to the top cell inside the infobox table. Default style is "<syntaxhighlight lang="css" inline>font-size:large;</syntaxhighlight>" (large font size), as this cell is often used as a title. If you want normal font size, include "<syntaxhighlight lang="css" inline>font-size:medium;</syntaxhighlight>" in the content for that cell.
;titleclass: 该参数影响信息框外标题的类。
;imagestyle: Applies to the image cell of the infobox including caption text. For compatibility and future changes, use captionstyle for caption text properties instead of imagestyle.
;aboveclass: 该参数影响信息框内标题的类。
;captionstyle: Applies to image caption text.
;headerstyle: Applies to all header cells.
;header(n)style: Applies to the nth header cell.
;labelstyle: Applies to all label cells. To avoid label text wrapping, include "<syntaxhighlight lang="css" inline>white-space:nowrap;</syntaxhighlight>". Or use "min-width: 4em;".
;label(n)style: Applies to the nth label cell.
;datastyle: Applies to all data cells.
;data(n)style: Applies to the nth data cell.
;belowstyle: Applies to the bottom cell.


通过为各个数据单元定义类名,本模板可以支持[[微格式]]信息;此处所说的类名,是根据标准定义的,且可以向机器表明信息的类型。例如,如果一个信息框使用了[[hCard]]的微格式,要在信息框内标记此微格式,则填写以下参数:
==== Microformats ====
;bodyclass: This parameter affects the class of the whole infobox.
;imageclass: This parameter affects the class of the image.
;class(n): This parameter affects the class of a specific line's data cell. Has no effect if there is no data cell in the infobox.
;titleclass: This parameter affects the class of the infobox's external title.
;aboveclass: This parameter affects the class of the infobox's internal title.
 
By defining class names for each data cell, this template can support [[microformats]] information; the class names are defined according to standards and can indicate information types to machines. For example, if an infobox uses the [[hCard]] microformat, to mark this microformat within the infobox, fill in the following parameters:


<pre>
<pre>
Line 68: Line 71:
</pre>
</pre>


并为每一个包含了vcard所需数据单元的行添加相应的类参数:
And for each line containing data required by the vcard, add the corresponding class parameter:


<pre>
<pre>
Line 76: Line 79:
</pre>
</pre>


等等。用于显示信息框主题的“above”和“title”也可以指定类。
etc. The "above" and "title" used to display the infobox's subject can also specify classes.


请在[[Wikipedia:專題/微格式]]以获取在维基百科添加微格式信息的进一步信息,访问[http://microformats.org/wiki/Main_Page microformats.org]网站亦能获取更一般性的信息。
For more information on adding microformat information on Wikipedia, visit [[Wikipedia:Microformats]] and the [http://microformats.org/wiki/Main_Page microformats.org] website for more general information.


=== 表格域可选项 ===
=== Optional Table Fields ===
如果表格的一行只有标签而没有数据,那么该行将不会显示。这样可以方便编者创建选填内容的行。要让某行成为可选项,只需填写一个默认为空字段的参数即可:
If a line in the table has only a label and no data, that line will not display. This allows editors to create lines with optional content. To make a line optional, include a parameter with an empty default field:


<pre>
<pre>
|label5 = 人口
|label5 = Population
|data5  = {{{population|}}}
|data5  = {{{population|}}}
</pre>
</pre>


这样的话,如果在条目中不定义“population”参数,则信息框的那一行不会被显示。
Thus, if the "population" parameter is not defined in the article, that line in the infobox will not display.


如果表格的一行填写的是预设格式内容(即除了参数外,还有其他内容),而又希望让该行成为可选项的话,你可以通过“#if”语句实现。当参数为空时,令所有的内容均不被呈现。譬如,在下面的例子里,“#if”会判断参数“mass”是否不为空,若不为空则显示它,并跟上“-{A|zh-hans:千克; zh-hant:公斤;}-”的后缀:
If a line in the table is filled with preset formatted content (i.e., content other than parameters) and you wish to make it optional, you can achieve this with an "#if" statement. When the parameter is empty, all content will not be displayed. For example, in the following example, "#if" checks if the "mass" parameter is not empty, and if so, displays it with the suffix "kg":


<pre>
<pre>
|label6 = 质量
|label6 = Mass
|data6  = {{#if:{{{mass|}}} |{{{mass}}}千克}}
|data6  = {{#if:{{{mass|}}} |{{{mass}}} kg}}
</pre>
</pre>


更多关于#if的用法,参见[[Help:模板扩展语法#if|此处]]
For more on using #if, see [[Help:Template syntax#if]].


如果你希望顶栏只在其下方的某个或多个数据单元有内容时才显示,以下的例子可以指导你如何实现:
If you want a header to display only when one or more data cells below it have content, the following example guides you on how to achieve that:


<pre style="overflow:auto;">
<pre style="overflow:auto;">
{{Infobox
{{Infobox
|name        = {{subst:PAGENAME}}
|name        = {{subst:PAGENAME}}
|title      = 可选顶栏的用例
|title      = Optional Header Use Case
|autoheaders = y
|autoheaders = y
|header1    = 可选顶栏
|header1    = Optional Header
|label2      = 项目一
|label2      = Item One
|data2      = {{{item_one|}}}
|data2      = {{{item_one|}}}
|label3      = 项目二
|label3      = Item Two
|data3      = {{{item_two|}}}
|data3      = {{{item_two|}}}
|label4      = 项目三
|label4      = Item Three
|data4      = {{{item_three|}}}
|data4      = {{{item_three|}}}
}}
}}
</pre>
</pre>


这样,只有在参数“item_one”、“item_two”或“item_three”其中之一被填写时,“header1”才会被显示。如果上述三个参数均未被定义,则顶栏不会显示。
Thus, "header1" will only display if one of the parameters "item_one," "item_two," or "item_three" is filled. If none of these parameters are defined, the header will not display.


过去在实现这一功能时,需嵌套冗长的“#if”语法,现在只需设置{{para|autoheaders|y}}即可。
Previously, implementing this feature required nesting lengthy "#if" syntax, but now you just need to set {{para|autoheaders|y}}.


=== 用例 ===
=== Examples ===
{|style="border: 0px; width: 100%;"
{|style="border: 0px; width: 100%;"
|-
|-
Line 129: Line 132:
|name        = Infobox
|name        = Infobox
|bodystyle    =  
|bodystyle    =  
|title        = 测试信息框
|title        = Test Infobox
|titlestyle  =  
|titlestyle  =  
|image        = [[File:No_image.svg|200px]]
|image        = [[File:No_image.svg|200px]]
Line 139: Line 142:
|datastyle    =  
|datastyle    =  


|header1 = 独自定义的顶栏
|header1 = Custom Header
|label1  =  
|label1  =  
|data1  =  
|data1  =  
|header2 =  
|header2 =  
|label2  = 独自定义的标签
|label2  = Custom Label
|data2  =  
|data2  =  
|header3 =
|header3 =
|label3  =  
|label3  =  
|data3  = 独自定义的数据
|data3  = Custom Data
|header4 = 三项均有定义(顶栏)
|header4 = All Three Defined (Header)
|label4  = 三项均有定义(标签)——错误:因为有设顶栏而不会显示出来
|label4  = All Three Defined (Label) — Error: Will not display due to header set
|data4  = 三项均有定义(数据)——错误:因为有设顶栏而不会显示出来
|data4  = All Three Defined (Data) — Error: Will not display due to header set
|header5 =
|header5 =
|label5  = 标签和数据有定义(标签)
|label5  = Label and Data Defined (Label)
|data5  = 标签和数据有定义(数据)
|data5  = Label and Data Defined (Data)


|belowstyle = background:#ddf;
|belowstyle = background:#ddf;
|below = 下方文本
|below = Below Text
}}</nowiki>}}
}}</nowiki>}}
|}
|}
注意到,当标签脱离数据单元单独定义时,所定义的那一行并未出现在信息框内;而当顶栏与标签、数据定义在同一栏时,顶栏将会优先显示。
Note that when a label is defined independently without a data cell, that line does not appear in the infobox; and when a header is defined along with label/data in the same line, the header takes precedence.


{{clear}}
{{clear}}
在下面的例子中,定义了“<code>{{nowrap|bodystyle {{=}} width:20em;}}</code>”和“<code>{{nowrap|labelstyle {{=}} width:33%;}}</code>”。
In the example below, "bodystyle = width:20em;" and "labelstyle = width:33%;" are defined.


{{Infobox
{{Infobox
|bodystyle    = width:20em;
|bodystyle    = width:20em;
|name        = Infobox
|name        = Infobox
|title        = 测试信息框
|title        = Test Infobox
|titlestyle  =  
|titlestyle  =  
|headerstyle  =  
|headerstyle  =  
Line 174: Line 177:


|header1 =  
|header1 =  
|label1  = 标签1
|label1  = Label 1
|data1  = 数据1
|data1  = Data 1
|header2 =  
|header2 =  
|label2  = 标签2
|label2  = Label 2
|data2  = 数据2
|data2  = Data 2
|header3 =  
|header3 =  
|label3  = 标签3
|label3  = Label 3
|data3  = 数据3
|data3  = Data 3
|header4 = 顶栏4
|header4 = Header 4
|label4  =  
|label4  =  
|data4  =  
|data4  =  
|header5 =  
|header5 =  
|label5  = 标签5
|label5  = Label 5
|data5  = 数据5:叽里呱啦稀里哗啦。
|data5  = Data 5: Gibberish.


|belowstyle =  
|belowstyle =  
|below = 下方文本
|below = Below Text
}}
}}


{{clear}}
{{clear}}


=== 完整模板 ===
=== Complete Template ===


(备注:本模板目前最多可以同时处理80行表格,一般的信息框模板只会用到前20行的参数,因此此处省略了后60行的参数。需使用时可依此类推。微格式“class”参数亦被省略,因其不常被用到,使用时请自行添加。)
(Note: This template can handle up to 80 table lines simultaneously, and general infobox templates usually only use the first 20 lines of parameters, so the remaining 60 lines of parameters are omitted here. Use as needed by analogy. The "class" parameter for microformats is also omitted as it is not often used; please add it when needed.)


<pre style="overflow:auto;">
<pre style="overflow:auto;">
Line 256: Line 259:
</pre>
</pre>


=== 参见 ===
=== See Also ===
* [[Special:前缀索引/Template:Infobox|所有以Template:Infobox为前缀的页面]]
* [[Special:PrefixIndex/Template:Infobox|All pages with Template:Infobox prefix]]


<includeonly>
<includeonly>
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:信息框模板|*]]
[[Category:Infobox templates|*]]
}}
}}
</includeonly>
</includeonly>

Latest revision as of 22:09, 9 November 2024

This template uses Module:Infobox, this script is written in Lua.
For more details, please refer to Wikipedia:Lua and Extension:Scribunto.

This template serves as a meta-template for a series of "Infobox" templates, meaning it is used to build other templates. It is generally not recommended to use this template directly in articles, but it can be used in specific "one-off" situations if necessary. See Help:Infobox for further methods to create general infoboxes.

Usage

This template is similar in usage to {{navbox}}, but there are some differences. Each line in the table can either be a header or a pair of label and data, or it can just be a single data cell. Each line can only have one state, with priority: if you define a line as both a header and a label/data pair, the label/data pair definition will be ignored.

Numbering

For ease of future changes to the infobox format, the numbering of header and label/data lines does not need to follow a strict order like 1, 2, 3, etc. You can leave gaps in the numbering to avoid renumbering all subsequent lines when adding new ones.

Header and label/data lines must not be repeated; for example, you cannot use both header1 and label1/data1 at the same time. Use header1, label2/data2 instead (as an example).

If you wish to renumber a large number of lines (such as when adding a new label requires incrementing all subsequent label numbers), consider using Module:IncrementParams.

Parameters

"View/Discuss/Edit/History" Links

name
The "View/Discuss/Edit/History" links need to point to the name of the template page (name). You can use {{subst:PAGENAME}}. If this parameter is not filled, the "View/Discuss/Edit/History" links will not display.

Title

Text outside the infobox title
(rest of the infobox)
Text inside the infobox title
(rest of the infobox)


There are two ways to add a title to an infobox. One is to place the title outside the infobox, and the other is to place it inside. You can choose either one based on your needs, use both, or even none at all (though we do not recommend the latter).

title
Text for the title outside the infobox table top.
above
Text for the title inside the infobox table top cell.

Optional

subheader
A subtitle below the above. Subheader2 is the second subtitle.
image
An image displayed at the top of the template. Use full image syntax, such as [[File:example.png|200px]]. It is recommended to use Module:InfoboxImage to insert images. By default, images are centered.


In the Chinese Wikipedia, an Infobox can use up to 4 image parameters: overimage (top), image (=image1), image2, image3, differing from the English Wikipedia Infobox which provides only image (=image1), image2.

caption
Caption text below the image.


Overcaption, caption (=caption1), caption2, caption3 correspond to the above 4 image parameters.

header(n)
Fill in the 'header' text for the nth line.
label(n)
Fill in the 'label' text for the nth line.
data(n)
Fill in the 'data' text for the nth line.
below
Text in the bottom cell of the infobox table, often used for notes, see also, and similar information.

Optional CSS Styles

bodystyle
Applies to the entire infobox table.
titlestyle
Applies to the title outside the infobox table. Background color is not recommended here as the text is outside the infobox.
abovestyle
Applies to the top cell inside the infobox table. Default style is "<syntaxhighlight lang="css" inline>font-size:large;</syntaxhighlight>" (large font size), as this cell is often used as a title. If you want normal font size, include "<syntaxhighlight lang="css" inline>font-size:medium;</syntaxhighlight>" in the content for that cell.
imagestyle
Applies to the image cell of the infobox including caption text. For compatibility and future changes, use captionstyle for caption text properties instead of imagestyle.
captionstyle
Applies to image caption text.
headerstyle
Applies to all header cells.
header(n)style
Applies to the nth header cell.
labelstyle
Applies to all label cells. To avoid label text wrapping, include "<syntaxhighlight lang="css" inline>white-space:nowrap;</syntaxhighlight>". Or use "min-width: 4em;".
label(n)style
Applies to the nth label cell.
datastyle
Applies to all data cells.
data(n)style
Applies to the nth data cell.
belowstyle
Applies to the bottom cell.

Microformats

bodyclass
This parameter affects the class of the whole infobox.
imageclass
This parameter affects the class of the image.
class(n)
This parameter affects the class of a specific line's data cell. Has no effect if there is no data cell in the infobox.
titleclass
This parameter affects the class of the infobox's external title.
aboveclass
This parameter affects the class of the infobox's internal title.

By defining class names for each data cell, this template can support microformats information; the class names are defined according to standards and can indicate information types to machines. For example, if an infobox uses the hCard microformat, to mark this microformat within the infobox, fill in the following parameters:

|bodyclass = vcard

And for each line containing data required by the vcard, add the corresponding class parameter:

|class1 = fn
|class2 = org
|class3 = tel

etc. The "above" and "title" used to display the infobox's subject can also specify classes.

For more information on adding microformat information on Wikipedia, visit Wikipedia:Microformats and the microformats.org website for more general information.

Optional Table Fields

If a line in the table has only a label and no data, that line will not display. This allows editors to create lines with optional content. To make a line optional, include a parameter with an empty default field:

|label5 = Population
|data5  = {{{population|}}}

Thus, if the "population" parameter is not defined in the article, that line in the infobox will not display.

If a line in the table is filled with preset formatted content (i.e., content other than parameters) and you wish to make it optional, you can achieve this with an "#if" statement. When the parameter is empty, all content will not be displayed. For example, in the following example, "#if" checks if the "mass" parameter is not empty, and if so, displays it with the suffix "kg":

|label6 = Mass
|data6  = {{#if:{{{mass|}}} |{{{mass}}} kg}}

For more on using #if, see Help:Template syntax#if.

If you want a header to display only when one or more data cells below it have content, the following example guides you on how to achieve that:

{{Infobox
|name        = {{subst:PAGENAME}}
|title       = Optional Header Use Case
|autoheaders = y
|header1     = Optional Header
|label2      = Item One
|data2       = {{{item_one|}}}
|label3      = Item Two
|data3       = {{{item_two|}}}
|label4      = Item Three
|data4       = {{{item_three|}}}
}}

Thus, "header1" will only display if one of the parameters "item_one," "item_two," or "item_three" is filled. If none of these parameters are defined, the header will not display.

Previously, implementing this feature required nesting lengthy "#if" syntax, but now you just need to set |autoheaders=y.

Examples

{{Infobox
|name         = Infobox
|bodystyle    = 
|title        = Test Infobox
|titlestyle   = 
|image        = [[File:No_image.svg|200px]]
|imagestyle   = 
|caption      = Caption for example.png
|captionstyle = 
|headerstyle  = background:#ccf;
|labelstyle   = background:#ddf;
|datastyle    = 

|header1 = Custom Header
|label1  = 
|data1   = 
|header2 = 
|label2  = Custom Label
|data2   = 
|header3 =
|label3  = 
|data3   = Custom Data
|header4 = All Three Defined (Header)
|label4  = All Three Defined (Label) — Error: Will not display due to header set
|data4   = All Three Defined (Data) — Error: Will not display due to header set
|header5 =
|label5  = Label and Data Defined (Label)
|data5   = Label and Data Defined (Data)

|belowstyle = background:#ddf;
|below = Below Text
}}
Test Infobox
Caption for example.png
Custom Header
Custom Data
All Three Defined (Header)
Label and Data Defined (Label)Label and Data Defined (Data)
Below Text

Note that when a label is defined independently without a data cell, that line does not appear in the infobox; and when a header is defined along with label/data in the same line, the header takes precedence.

In the example below, "bodystyle = width:20em;" and "labelstyle = width:33%;" are defined.

Test Infobox
Label 1Data 1
Label 2Data 2
Label 3Data 3
Header 4
Label 5Data 5: Gibberish.
Below Text


Complete Template

(Note: This template can handle up to 80 table lines simultaneously, and general infobox templates usually only use the first 20 lines of parameters, so the remaining 60 lines of parameters are omitted here. Use as needed by analogy. The "class" parameter for microformats is also omitted as it is not often used; please add it when needed.)

{{Infobox
| name               = {{subst:PAGENAME}}
| child              = {{{child|}}}
| subbox             = {{{subbox|}}}
| italic title       = {{{italic title|no}}}
| bodystyle          = 
| titlestyle         = 
| abovestyle         = 
| subheaderstyle     = 
| title              = 
| above              = 
| subheader          = 
| imagestyle         = 
| captionstyle       = 
| image              = 
| caption            = 
| image2             = 
| caption2           = 
| headerstyle        = 
| labelstyle         = 
| datastyle          = 
| header1            = 
| label1             = 
| data1              = 
| header2            = 
| label2             = 
| data2              = 
| header3            = 
| label3             = 
| data3              = 
| header4            = 
| label4             = 
| data4              = 
| header5            = 
| label5             = 
| data5              = 
| header6            = 
| label6             = 
| data6              = 
| header7            = 
| label7             = 
| data7              = 
| header8            = 
| label8             = 
| data8              = 
| header9            = 
| label9             = 
| data9              = 
| header10           = 
| label10            = 
| data10             = 
| belowstyle         = 
| below              = 
}}

See Also