Template:Infobox/doc: Difference between revisions
imported>Caesar Schinas No edit summary |
imported>Caesar Schinas (Full styling support) |
||
Line 1: | Line 1: | ||
<br /> | <br /> | ||
==== Usage ==== | ==== Usage ==== | ||
The title of the infobox is defined by the '''<code>title</code>''' variable. | CSS styles such as <code>background-color</code> can optionally be defined using the following variables. | ||
* '''<code>style</code>''' (styles which will apply to the entire infobox) | |||
* '''<code>labelstyle</code>''' (styles which should be applied to every label in the entire infobox) | |||
* '''<code>datastyle</code>''' (styles which should be applied to every data cell in the entire infobox) | |||
These styles can be overridden on a per-cell basis using the per-cell style variables below. | |||
The title of the infobox is defined by the '''<code>title</code>''' variable.<br /> | |||
The subtitle is defined by the '''<code>subtitle</code>''' variable. | |||
Each row is defined using a combination of the following variables. | Each row is defined using a combination of the following variables. | ||
*'''<code> | *'''<code>#_label</code>''' | ||
*'''<code> | *'''<code>#_labelstyle</code>''' | ||
*'''<code> | *'''<code>#_data</code>''' | ||
*'''<code> | *'''<code>#_datastyle</code>''' | ||
The # in the above variables must be replaced by the row number, as seen below (''eg'' '''<code>1_label</code>''' and '''<code>1_data</code>''' for the first row, etc). | |||
The data variables can be used alone to create a full-width data row without a label.<br /> | The data variables can be used alone to create a full-width data row without a label.<br /> | ||
Line 14: | Line 22: | ||
Up to 25 different rows can be defined. | Up to 25 different rows can be defined. | ||
All variables are optional, though it is clearly pointless to create an infobox with no data whatsoever. | |||
==== Example ==== | ==== Example ==== | ||
{{Infobox | {{Infobox | ||
| style = background-color:#ccf; | |||
| labelstyle = background-color:#99f; color:#00f; | |||
| datastyle = background-color:#eef; color:#009; | |||
| title = This is the title | | title = This is the title | ||
| titlestyle = color:#f00; | |||
| subtitle = This is the subtitle | |||
| subtitlestyle = color:#00f; | |||
| 1_label = 1 A Header | | 1_label = 1 A Header | ||
| 1_data = --- | | 1_data = --- | ||
| 2_label = 2 A Label | | 2_label = 2 A Label | ||
| 2_data = 2 Some Data | | 2_data = 2 Some Data | ||
| 3_label = 3 Another Label | | 3_label = 3 Another Label | ||
| 3_data = 3 Some more Data | | 3_data = 3 Some more Data | ||
| 4_label = 4 A Header | | 4_label = 4 A Header | ||
| 4_data = --- | | 4_data = --- | ||
| 5_label = 5 A Label only | | 5_label = 5 A Label only | ||
| 6_data = 6 Some data only that expands across both columns | | 6_data = 6 Some data only that expands across both columns | ||
| 7_label = 7 A Header | | 7_label = 7 A Header | ||
| 7_labelstyle = background:lightgrey | | 7_labelstyle = background:lightgrey | ||
| 7_data = --- | | 7_data = --- | ||
| 8_label = 8 A Label | | 8_label = 8 A Label | ||
| 8_labelstyle = background:lightblue; font-style:italic | | 8_labelstyle = background:lightblue; font-style:italic | ||
| 8_data = 8 Some Data | | 8_data = 8 Some Data | ||
| 9_label | |||
| 9_data | | 9_label = 9 Another Label | ||
| 9_datastyle | | 9_data = 9 Some more Data | ||
| 9_datastyle = background:lightgreen; font-style:italic | |||
| 10_label = 10 Another Label | | 10_label = 10 Another Label | ||
| 10_labelstyle = background:lightblue | | 10_labelstyle = background:lightblue | ||
| 10_data = 10 Some more Data | | 10_data = 10 Some more Data | ||
| 10_datastyle = background:lightgreen | | 10_datastyle = background:lightgreen | ||
| 11_label = 11 A Header | | 11_label = 11 A Header | ||
| 11_data = --- | | 11_data = --- | ||
| 12_data = 12 Some data only that expands across both columns | | 12_data = 12 Some data only that expands across both columns | ||
| 12_datastyle =background:lightgreen; font-style:italic; border: 1px solid red | | 12_datastyle = background:lightgreen; font-style:italic; border: 1px solid red | ||
}} | }} | ||
<pre> | <pre> | ||
{{Infobox | {{Infobox | ||
| style = background-color:#ccf; | |||
| labelstyle = background-color:#99f; color:#00f; | |||
| datastyle = background-color:#eef; color:#009; | |||
| title = This is the title | | title = This is the title | ||
| titlestyle = color:#f00; | |||
| subtitle = This is the subtitle | |||
| subtitlestyle = color:#00f; | |||
| 1_label = 1 A Header | | 1_label = 1 A Header | ||
| 1_data = --- | | 1_data = --- | ||
| 2_label = 2 A Label | | 2_label = 2 A Label | ||
| 2_data = 2 Some Data | | 2_data = 2 Some Data | ||
| 3_label = 3 Another Label | | 3_label = 3 Another Label | ||
| 3_data = 3 Some more Data | | 3_data = 3 Some more Data | ||
| 4_label = 4 A Header | | 4_label = 4 A Header | ||
| 4_data = --- | | 4_data = --- | ||
| 5_label = 5 A Label only | | 5_label = 5 A Label only | ||
| 6_data = 6 Some data only that expands across both columns | | 6_data = 6 Some data only that expands across both columns | ||
| 7_label = 7 A Header | | 7_label = 7 A Header | ||
| 7_labelstyle = background:lightgrey | | 7_labelstyle = background:lightgrey | ||
| 7_data = --- | | 7_data = --- | ||
| 8_label = 8 A Label | | 8_label = 8 A Label | ||
| 8_labelstyle = background:lightblue; font-style:italic | | 8_labelstyle = background:lightblue; font-style:italic | ||
| 8_data = 8 Some Data | | 8_data = 8 Some Data | ||
| 9_label | |||
| 9_data | | 9_label = 9 Another Label | ||
| 9_datastyle | | 9_data = 9 Some more Data | ||
| 9_datastyle = background:lightgreen; font-style:italic | |||
| 10_label = 10 Another Label | | 10_label = 10 Another Label | ||
| 10_labelstyle = background:lightblue | | 10_labelstyle = background:lightblue | ||
| 10_data = 10 Some more Data | | 10_data = 10 Some more Data | ||
| 10_datastyle = background:lightgreen | | 10_datastyle = background:lightgreen | ||
| 11_label = 11 A Header | | 11_label = 11 A Header | ||
| 11_data = --- | | 11_data = --- | ||
| 12_data = 12 Some data only that expands across both columns | | 12_data = 12 Some data only that expands across both columns | ||
| 12_datastyle =background:lightgreen; font-style:italic; border: 1px solid red | | 12_datastyle = background:lightgreen; font-style:italic; border: 1px solid red | ||
}} | }} | ||
</pre> | </pre> |
Revision as of 03:18, 4 May 2009
Usage
CSS styles such as background-color
can optionally be defined using the following variables.
style
(styles which will apply to the entire infobox)labelstyle
(styles which should be applied to every label in the entire infobox)datastyle
(styles which should be applied to every data cell in the entire infobox)
These styles can be overridden on a per-cell basis using the per-cell style variables below.
The title of the infobox is defined by the title
variable.
The subtitle is defined by the subtitle
variable.
Each row is defined using a combination of the following variables.
#_label
#_labelstyle
#_data
#_datastyle
The # in the above variables must be replaced by the row number, as seen below (eg 1_label
and 1_data
for the first row, etc).
The data variables can be used alone to create a full-width data row without a label.
A centred bold header, without data, can be created by setting the data variable to ---
.
If no label or data style is designated the default styles will be used.
Up to 25 different rows can be defined.
All variables are optional, though it is clearly pointless to create an infobox with no data whatsoever.
Example
This is the title | |
---|---|
This is the subtitle | |
1 A Header | |
2 A Label | 2 Some Data |
3 Another Label | 3 Some more Data |
4 A Header | |
6 Some data only that expands across both columns | |
7 A Header | |
8 A Label | 8 Some Data |
9 Another Label | 9 Some more Data |
10 Another Label | 10 Some more Data |
11 A Header | |
12 Some data only that expands across both columns |
{{Infobox | style = background-color:#ccf; | labelstyle = background-color:#99f; color:#00f; | datastyle = background-color:#eef; color:#009; | title = This is the title | titlestyle = color:#f00; | subtitle = This is the subtitle | subtitlestyle = color:#00f; | 1_label = 1 A Header | 1_data = --- | 2_label = 2 A Label | 2_data = 2 Some Data | 3_label = 3 Another Label | 3_data = 3 Some more Data | 4_label = 4 A Header | 4_data = --- | 5_label = 5 A Label only | 6_data = 6 Some data only that expands across both columns | 7_label = 7 A Header | 7_labelstyle = background:lightgrey | 7_data = --- | 8_label = 8 A Label | 8_labelstyle = background:lightblue; font-style:italic | 8_data = 8 Some Data | 9_label = 9 Another Label | 9_data = 9 Some more Data | 9_datastyle = background:lightgreen; font-style:italic | 10_label = 10 Another Label | 10_labelstyle = background:lightblue | 10_data = 10 Some more Data | 10_datastyle = background:lightgreen | 11_label = 11 A Header | 11_data = --- | 12_data = 12 Some data only that expands across both columns | 12_datastyle = background:lightgreen; font-style:italic; border: 1px solid red }}