Template:Infobox

From Creatura Wiki
Template documentation (View · Edit · History · Purge)
Template:Tocright

Description[edit]

This template is used to create an infobox. This template generally should not be used directly on pages, and should instead be used on other template pages, which are then transcluded into pages (thus creating two transclusion layers instead of just one).

Usage[edit]

Usage is similar to Template:Tl, but much simpler. Each row on the table can contain either a header, a label/data pair, or just a data cell.

This all seems very complicated at first, but it will be easier as we go along (with examples too!).

Title parameters[edit]

above

This parameter places its contents in the uppermost cell of the table. This serves as the "title" of the infobox, and is best used to list the name of the subject it is describing.

subheader

Adds an additional title field that is shown just below above, but above any images in the infobox.

Examples[edit]

Title
Subheader
{{Infobox
|above          = Title
|subheader      = Subheader
}}

Image parameters[edit]

These parameters display the first image shown in the infobox. In general, one image works best; if you want a montage, it's best to create one using an image editing program and uploading it to the wiki as one image.

Additional images can be shown later in the text by using the dataN parameters without the headerN and labelN parameters (we'll show you what we mean later).

image

Specify the file name of the image you want to use. Use full image syntax (e.g. [[File:Example.png]]. You can resize the image if needed (e.g. [[File:Example.png|250px]]).

caption

Adds a caption underneath the image. Will not work if image is empty.

Examples[edit]

Beef Jerky
Food item
Beef Jerky on a plate

A plate of beef jerky.

{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|image          = [[File:Jerky (1).jpg|250px|alt=Beef Jerky on a plate]]
|caption        = A plate of beef jerky.
}}

Main data parameters[edit]

Replace N with a number. The numbers will determine the ordering of the values, and should add up as you add more parameters. Template:Tl supports up to 80 of these parameters; any additional parameters after that will be ignored (but really, who needs 80 cells in an infobox?).

headerN

Used to add a header that will be bolded and centered. Good for dividing information up within an infobox.

labelN

Used to add a label that will be shown on the left and in bold. If a corresponding headerN is used, it will appear under that. A corresponding dataN is required for this parameter to work; otherwise it will simply be ignored.

dataN

Used to add the actual data of the infobox. If a corresponding labelN is used, it will appear to the right of that. If a corresponding headerN is used, it will appear under that. dataN can be used without a corresponding labelN, in which case it will be centered.

Examples[edit]

Using the first two label and data parameters, without headers.

Beef Jerky
Food item
Effect +10 HP
Weight 0.1 lbs
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|label1         = Effect
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs
}}

Notice how the ordering changes when N is changed. The ordering of the parameters in the wikitext of the page does not matter.

Beef Jerky
Food item
Weight 0.1 lbs
Effect +10 HP
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|label2         = Effect
|data2          = +10 HP
|label1         = Weight
|data1          = 0.1 lbs
}}

It is okay to skip numbers; doing so has no effect on the output of the template. This can be useful if you want to "reserve" positions on the template for future parameters.

Beef Jerky
Food item
Effect +10 HP
Weight 0.1 lbs
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|label1         = Effect
|data1          = +10 HP
|label5         = Weight
|data5          = 0.1 lbs
}}

First three label and data parameters, with headers.

Beef Jerky
Food item
Stats
Effect +10 HP
Weight 0.1 lbs
Real-life information
Texture Chewy
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|header1        = Stats
|label1         = Effect
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs

|header3        = Real-life information
|label3         = Texture
|data3          = Chewy
}}

First data parameter, without label.

Beef Jerky
Food item
Stats
+10 HP
Weight 0.1 lbs
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|header1        = Stats
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs
}}

Below parameter[edit]

below

Text to put in the bottom cell, below all the other cells. This cell is good for things like footnotes, "See also" sections, and other information.

Examples[edit]

Beef Jerky
Food item
Stats
+10 HP
Weight 0.1 lbs
It tastes great!
{{Infobox
|above          = Beef Jerky
|subheader      = Food item

|header1        = Stats
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs

|below          = It tastes great!
}}

Adding images to the body of the infobox[edit]

The infobox contains only one image parameter, which displays images near the top of the infobox. However, it is still possible to insert an image later in the text using dataN parameters.

To do this, simply add the desired image in full image syntax to a dataN parameter, leaving the corresponding labelN parameter blank.

Beef Jerky
Food item
Beef Jerky on a plate

A plate of beef jerky.

Effect +10 HP
Weight 0.1 lbs
Venison jerky
{{Infobox
|above          = Beef Jerky
|subheader      = Food item
|image          = [[File:Jerky (1).jpg|250px|alt=Beef Jerky on a plate]]
|caption        = A plate of beef jerky.

|label1         = Effect
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs

|data3          = [[File:Venison jerky.jpg|250px|alt=Venison jerky]]
}}

For a caption, simply use the next dataN parameter and leave your caption there, again without its corresponding labelN.

Beef Jerky
Food item
Beef Jerky on a plate

A plate of beef jerky.

Effect +10 HP
Weight 0.1 lbs
Venison jerky
Venison strips before drying.
{{Infobox
|above          = Beef Jerky
|subheader      = Food item
|image          = [[File:Jerky (1).jpg|250px|alt=Beef Jerky on a plate]]
|caption        = A plate of beef jerky.

|label1         = Effect
|data1          = +10 HP
|label2         = Weight
|data2          = 0.1 lbs

|data3          = [[File:Venison jerky.jpg|250px|alt=Venison jerky]]
|data4          = Venison strips before drying.
}}

CSS styling parameters[edit]

These templates can be used to apply Cascading Style Sheets styling to the infobox. All parameters here are optional.

bodystyle

Applies to the infobox as a whole.

abovestyle

Applies to the above cell only. The default size is 125%, since this parameter is usually used for a title. If you want to use this cell for regular-sized text, add font-size:100% to this parameter.

subheaderstyle

Applies to the subheader cell only.

imagestyle

Applies to the cell the image is in. Also applies to the caption as well.

captionstyle

Applies to the text of the image caption.

headerstyle

Applies to all headers in the infobox.

labelstyle

Applies to all label cells.

datastyle

Applies to all data cells.

belowstyle

Applies only to the below cell.

HTML class parameters[edit]

bodyclass

This parameter is inserted into the class attribute for the infobox as a whole.

aboveclass

This parameter is inserted into the class attribute for the above cell.

subheaderclass

This parameter is inserted into the class attribute for the subheader cell.

imageclass

This parameter is inserted into the class attribute for the image.

classN

This parameter is inserted into the class attribute for the data cell of the specified row. It is ignored if the corresponding dataN cell does not exist.

belowclass

This parameter is inserted into the class attribute for the below cell.

Unused parameters[edit]

title

The use of title is not recommended as the title is not centered on the infobox, resulting in general unsightliness. You can still use it if you want to, for whatever reason. Use above instead.

Full syntax[edit]

{{Infobox
|title          = 
|above          = 
|subheader      = 
|image          = 
|caption        = 

|bodyclass      = 
|bodystyle      = 
|titleclass     = 
|titlestyle     = 
|aboveclass     = 
|abovestyle     = 
|subheaderclass = 
|subheaderstyle = 

|imageclass     = 
|imagestyle     = 
|captionstyle   = 

|headerstyle    = 
|labelstyle     = 
|datastyle      = 

|header1        = 
|label1         = 
|data1          = 
|class1         = 

|header2        = 
|label2         = 
|data2          = 
|class2         = 

|header3        = 
|label3         = 
|data3          = 
|class3         = 

|header4        = 
|label4         = 
|data4          = 
|class4         = 

|header5        = 
|label5         = 
|data5          = 
|class5         = 

|header6        = 
|label6         = 
|data6          = 
|class6         = 

|header7        = 
|label7         = 
|data7          = 
|class7         = 

|header8        = 
|label8         = 
|data8          = 
|class8         = 

|header9        = 
|label9         = 
|data9          = 
|class9         = 

|header10       = 
|label10        = 
|data10         = 
|class10        = 

...

|header80       = 
|label80        = 
|data80         = 
|class80        = 

}}

CSS[edit]

This template requires the use of some CSS styling parameters in order to display correctly, which can be found at MediaWiki:Common.css.

If you are exporting this template to another wiki, be sure to paste the following code into the appropriate .css page on your wiki.

CSS code
/* Infobox template style */
/* Code copied from [[wikipedia:MediaWiki:Common.css]] */
.infobox {
    border: 1px solid #a2a9b1;
    border-spacing: 3px;
    background-color: #f8f9fa;
    color: black;
    /* @noflip */
    margin: 0.5em 0 0.5em 1em;
    padding: 0.2em;
    /* @noflip */
    float: right;
    /* @noflip */
    clear: right;
    font-size: 88%;
    line-height: 1.5em;
}
.infobox caption {
    font-size: 125%;
    font-weight: bold;
    padding: 0.2em;
}
.infobox td,
.infobox th {
    vertical-align: top;
    /* @noflip */
    text-align: left;
}
.infobox.bordered {
    border-collapse: collapse;
}
.infobox.bordered td,
.infobox.bordered th {
    border: 1px solid #a2a9b1;
}
.infobox.bordered .borderless td,
.infobox.bordered .borderless th {
    border: 0;
}

.infobox.sisterproject {
    width: 20em;
    font-size: 90%;
}

.infobox.standard-talk {
    border: 1px solid #c0c090;
    background-color: #f8eaba;
}
.infobox.standard-talk.bordered td,
.infobox.standard-talk.bordered th {
    border: 1px solid #c0c090;
}

/* END Infobox template style */

/* styles for bordered infobox with merged rows */
/* Code copied from [[wikipedia:MediaWiki:Common.css]] */
.infobox.bordered .mergedtoprow td,
.infobox.bordered .mergedtoprow th {
    border: 0;
    border-top: 1px solid #a2a9b1;
    /* @noflip */
    border-right: 1px solid #a2a9b1;
}

.infobox.bordered .mergedrow td,
.infobox.bordered .mergedrow th {
    border: 0;
    /* @noflip */
    border-right: 1px solid #a2a9b1;
}

/* Styles for geography infoboxes, eg countries,
   country subdivisions, cities, etc.            */
.infobox.geography {
    border-collapse: collapse;
    line-height: 1.2em;
    font-size: 90%;
}

.infobox.geography  td,
.infobox.geography  th {
    border-top: 1px solid #a2a9b1;
    padding: 0.4em 0.6em 0.4em 0.6em;
}
.infobox.geography .mergedtoprow td,
.infobox.geography .mergedtoprow th {
    border-top: 1px solid #a2a9b1;
    padding: 0.4em 0.6em 0.2em 0.6em;
}

.infobox.geography .mergedrow td,
.infobox.geography .mergedrow th {
    border: 0;
    padding: 0 0.6em 0.2em 0.6em;
}

.infobox.geography .mergedbottomrow td,
.infobox.geography .mergedbottomrow th {
    border-top: 0;
    border-bottom: 1px solid #a2a9b1;
    padding: 0 0.6em 0.4em 0.6em;
}

.infobox.geography .maptable td,
.infobox.geography .maptable th {
    border: 0;
    padding: 0;
}
/* END styles for bordered infobox with merged rows */

Credits[edit]

This template's code was taken from Wikipedia:WikiProject Transwiki/Template:Infobox. It is a modified version of the Infobox template for the English Wikipedia that was meant to be portable to other MediaWiki installations.

Parts of this template's documentation was taken from Template:Infobox/doc on the English Wikipedia. The images used in this documentation are from the Wikimedia Commons.


Visit Template:Infobox/doc to edit this text! (How does this work?) (Refresh this text - why?)