Template:Infobox: Difference between revisions
Template page
More actions
Created page with "<includeonly>{| class="infobox" style="width: 22em; border-spacing: 3px;" {{#if:{{{title|}}}| ! colspan="2" class="infobox-title" | {{{title}}} }} {{#if:{{{image|}}}| <tr> <td colspan="2" class="infobox-image" style="text-align:center;">{{{image}}}</td> </tr> }} {{#if:{{{caption|}}}| <tr> <td colspan="2" class="infobox-caption" style="text-align:center;">{{{caption}}}</td> </tr> }} <!-- Headers and Data Rows --> {{#if:{{{header1|}}}|<tr><th colspan="2" class="infobox-he..." |
No edit summary |
||
| Line 33: | Line 33: | ||
{{#if:{{{label14|}}}|<tr><th class="infobox-label">{{{label14}}}</th><td class="infobox-data">{{{data14|}}}</td></tr>}} | {{#if:{{{label14|}}}|<tr><th class="infobox-label">{{{label14}}}</th><td class="infobox-data">{{{data14|}}}</td></tr>}} | ||
{{#if:{{{label15|}}}|<tr><th class="infobox-label">{{{label15}}}</th><td class="infobox-data">{{{data15|}}}</td></tr>}} | {{#if:{{{label15|}}}|<tr><th class="infobox-label">{{{label15}}}</th><td class="infobox-data">{{{data15|}}}</td></tr>}} | ||
{{#if:{{{header16|}}}|<tr><th colspan="2" class="infobox-header">{{{header16}}}</th></tr>}} | |||
{{#if:{{{label17|}}}|<tr><th class="infobox-label">{{{label17}}}</th><td class="infobox-data">{{{data17|}}}</td></tr>}} | |||
{{#if:{{{label18|}}}|<tr><th class="infobox-label">{{{label18}}}</th><td class="infobox-data">{{{data18|}}}</td></tr>}} | |||
{{#if:{{{header19|}}}|<tr><th colspan="2" class="infobox-header">{{{header19}}}</th></tr>}} | |||
{{#if:{{{label20|}}}|<tr><th class="infobox-label">{{{label20}}}</th><td class="infobox-data">{{{data20|}}}</td></tr>}} | |||
<!-- Add more rows as needed by copying the pattern above --> | <!-- Add more rows as needed by copying the pattern above --> | ||
Latest revision as of 19:04, 14 August 2025
This is a generic infobox template. It creates a right-aligned table with alternating labels and data.
How it works edit source
This template uses pairs of parameters, like `label2` and `data2`, to create rows. A `header` parameter creates a full-width header row. The `` parser function ensures that a row is only created if its corresponding parameter (e.g., `label2` or `header1`) is given a value.
CSS Styles edit source
For this template to display correctly, you may need to add the following styles to your wiki's common CSS file (e.g., MediaWiki:Common.css):
.infobox {
border: 1px solid #aaa;
background-color: #f9f9f9;
color: black;
margin: 0.5em 0 0.5em 1em;
padding: 0.2em;
float: right;
clear: right;
}
.infobox-title {
font-size: 125%;
font-weight: bold;
text-align: center;
}
.infobox-header {
background-color: #e0e0e0;
text-align: center;
}
.infobox-label {
font-weight: bold;
text-align: left;
vertical-align: top;
padding-right: 0.65em;
}
.infobox-data {
vertical-align: top;
}