Template:Infobox: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 6: | Line 6: | ||
{{Infobox/SectionHeader|section={{{example_section}}}}} |
{{Infobox/SectionHeader|section={{{example_section}}}}} |
||
{{Infobox/Item|key=Sample data|value={{{example_data}}}}} |
{{Infobox/Item|key=Sample data|value={{{example_data}}}}} |
||
+ | {{Infobox/Vertical Item|key=Vertical sample|value={{{example_data_2}}}}} |
||
+ | {{Infobox/Bar}} |
||
+ | {{Infobox/Dual Illustration|left_file={{{illustration}}}|left_caption={{{caption}}}|right_file={{{illustration}}}|right_caption={{{caption}}}}} |
||
+ | {{Infobox/Bar}} |
||
+ | {{Infobox/Column}} |
||
+ | {{Infobox/Three Column|leftValue={{{force_1_list}}}|centerValue={{{force_2_list}}}|rightValue={{{force_3_list}}}}} |
||
+ | {{Infobox/Column|leftValue={{{force_1_list}}}|rightValue={{{force_2_list}}}}} |
||
{{Infobox/end}} |
{{Infobox/end}} |
||
<nowiki /></includeonly> |
<nowiki /></includeonly> |
Revision as of 19:38, 26 October 2022
{{{title}}}
|
|||||||
---|---|---|---|---|---|---|---|
{{{illustration}}} | |||||||
{{{caption}}} | |||||||
{{{example_section}}} | |||||||
Sample data | {{{example_data}}} | ||||||
Vertical sample | |||||||
{{{example_data_2}}} | |||||||
|
|||||||
{{{leftValue}}} | {{{rightValue}}} | ||||||
{{{force_1_list}}} | {{{force_2_list}}} | {{{force_3_list}}} | |||||
{{{force_1_list}}} | {{{force_2_list}}} |
Example
The following markup will produce the output presented to the right of this paragraph :
{{Infobox | title = Example | illustration = [[File:KP dark.png]] | caption = Example infobox | example_section = Example section | example_data = Soap floats on water, but its efficiency at naval battles is yet to be proven }}
Templates are floated to the right, which means they will appear in the document shifted to the right of the page, whilst being kept in the document flow (ie, text will wrap around them. Templates will "clear" off each other, and appear below the previous ones in the order they were added into the document flow. As an example, there is a template between here...
A second infobox
|
|||||||
---|---|---|---|---|---|---|---|
{{{illustration}}} | |||||||
{{{caption}}} | |||||||
{{{example_section}}} | |||||||
Sample data | {{{example_data}}} | ||||||
Vertical sample | |||||||
{{{example_data_2}}} | |||||||
|
|||||||
{{{leftValue}}} | {{{rightValue}}} | ||||||
{{{force_1_list}}} | {{{force_2_list}}} | {{{force_3_list}}} | |||||
{{{force_1_list}}} | {{{force_2_list}}} |
...and here, and it should appear directly below the previous one.
This behaviour may sometimes cause problems with block
elements (see the CSS display modes), as these elements typically will ignore floats and "slide" underneath them, whereas their content will behave normally and wrap around the floating element.
To solve that problem, or for readability and design, you will often find yourself in need of "pushing" the rest of the document's flow after a floating box. The Template:clr will do that for you, and is used by inserting {{clr}}
at any point in your document. All content after that point will clear from all floating elements and will appear below them, like this paragraph.
Using, creating and modifying infoboxes
Usage
You should not directly use this template itself. Instead use other templates already created in Category:Infoboxes, or create a new one. This template serves as a framework to define common rules between all infoboxes and providing a root page for sub-templates defined below.
Sub-templates components
In order to ease the creation of infoboxes, this basic template is itself made of reusable components which can be reused in other templates. They are listed below, and may be used in your own templates. You can also create new ones.
{{Infobox/Header|...}}
: This component defines the header title of an infobox (the "bold greyed" part at the top of an infobox). The following arguments can be used :title
: The title to display.
{{Infobox/Illustration|...}}
: This component represents an image and it's associated caption which are usually used to illustrate an infobox. The following arguments can be used :file
: The picture to display (which can be uploaded or inserted using the editor's "Embed File" button)caption
: A caption for the picture
{{Infobox/SectionHeader|...}}
: This component defines a section header, which helps grouping and separating attributes in an infobox. The following arguments can be used :section
: The new section's title
{{Infobox/Item|...}}
: This is the basic "key-value" attribute of an infobox used to present a piece of data with a label. The following arguments can be used :key
: The (readable) label of an attribute, which should consist of a few, chosen words like "Type" or "Date of birth". Avoid long labels like "Date at which this aircraft experienced its first air battle over foreign territory", they tend to break the infobox's design by making it hard to read.value
: The value (content) of the attribute.
{{Infobox/Column|...}}
:{{Infobox/begin|...}}
and{{Infobox/end}}
: These are mandatory to any infobox and defines the beginning and end of an infobox. They must be respectively the first and last components of an infobox template. The following arguments can be used in{{Infobox/begin|...}}
:nofloat
: Whennofloat
is set totrue
, the infobox will not float to the right and will instead remain in the document flow as a block element (text will break before and after it. Additionally it will appear centered on the page. When set to any other value, or not set at all, the infobox will use the normal "float to the right" behaviour.
Specifications
Generic floating infobox.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Title | title | Title that appears at the top of the infobox.
| String | required |
Illustration | illustration | A picture describing the subject. | File | optional |
Caption | caption | A short descriptive text for the illustration. | String | optional |
example_section | example_section | This is only used for demonstration purposes. Any children template inheriting from this one should remove this attribute. | Unknown | deprecated |
example_data | example_data | This is only used for demonstration purposes. Any children template inheriting from this one should remove this attribute. | Unknown | deprecated |
nofloat | nofloat | Setting any value to this parameter will make the infobox stop floating to the right. | Unknown | optional |