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 difference)
|
Revision as of 18:22, 14 August 2025
This is a generic infobox template. It creates a right-aligned table with alternating labels and data.
How it works
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
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;
}