Template:Infobox: Difference between revisions

From Foxwells Wiki
Jump to navigation Jump to search
infobox
m add ckear
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<table class="infobox" style="
<noinclude>{{Infobox
  border:1px solid {{{border-color|#aaa}}};
| title = Example Infobox
  background: {{{background-color|#f9f9f9}}};
| image = Example.jpg
  width: {{{width|300px}}};
| image_alt = An example image
  font-size:90%;
| image_caption = Caption goes here
  font-family:sans-serif;
| content = <p>The content of an '''Infobox''' is just regular WikiText!</p>
  clear: {{{clear|none}}};
| width = 250px
">
}}
   <tr>
This template creates a styled infobox with customizable colors and flexible content.
    <th colspan="2" style="
 
      background: {{{title-background-color|#ccc}}};
== Parameters ==
      color: {{{title-text-color|#000}}};
* `title`: Title of the infobox
      text-align:center;
* `image`: (Optional) Filename of an image (must be uploaded)
      font-size:1.2em;
* `image_alt`: Image alt text
      padding:0.3em;
* `image_caption`: (Optional) Text shown below the image
    ">
* `content`: The main content (use paragraphs, images, etc.)
      {{{title|}}}
* `width`: CSS width (e.g., `300px`)
    </th>
* `aspect-ratio`: (Optional) CSS aspect-ratio for content box
   </tr>
* `border-colour`: Border color of the box
* `background-colour`: Background color of the title
* `text-colour`: Text color of the title
* `clear`: CSS `clear` property (e.g., `right`, `left`)
</noinclude><includeonly><templatestyles src="Infobox/styles.css"/>
<div class="ec-infobox" style="border-color: {{{border-colour|#aaa}}}; float: {{{float|right}}}; clear: {{clear|none}};">
   <div class="ec-infobox-title" style="background-color: {{{background-colour|#ccc}}}; color: {{{text-colour|#000}}}">
    {{{title}}}
   </div>
   {{#if:{{{image|}}}
   {{#if:{{{image|}}}
    | <tr>
  |<div class="ec-infobox-image" style="text-align:center; margin-top:0.5em;">
        <td colspan="2" style="text-align:center; padding:0.4em;">
    [[File:{{{image}}}|{{{width|250px}}}|alt={{{image_alt|}}}]]
          [[File:{{{image}}}|250px|alt={{{image_alt|}}}]]
    {{#if:{{{image_caption|}}}|<div style="font-size:0.85em; font-style:italic;">{{{image_caption}}}</div>}}
          {{#if:{{{image_caption|}}}
  </div>
            |<div style="font-size:0.85em; font-style:italic; margin-top:0.3em;">{{{image_caption}}}</div>
          }}
        </td>
      </tr>
  }}
  {{#if:{{{type|}}}
    | <tr>
        <td style="font-weight:bold; width:110px; padding:0.2em;">Type</td>
        <td style="padding:0.2em;">{{{type}}}</td>
      </tr>
   }}
   }}
   {{#if:{{{date|}}}
   <div class="ec-infobox-content" style="width: {{{width|250px}}}; aspect-ratio: {{{aspect-ratio|auto}}}">
    | <tr>
     {{{content}}}
        <td style="font-weight:bold; padding:0.2em;">Date</td>
   </div>
        <td style="padding:0.2em;">{{{date}}}</td>
</div>
      </tr>
</includeonly>
  }}
  {{#if:{{{location|}}}
    | <tr>
        <td style="font-weight:bold; padding:0.2em;">Location</td>
        <td style="padding:0.2em;">{{{location}}}</td>
      </tr>
  }}
  {{#if:{{{domain|}}}
    | <tr>
        <td style="font-weight:bold; padding:0.2em;">Domain</td>
        <td style="padding:0.2em;">
          {{#if:{{{domain_url|}}}
            | [{{{domain_url}}} {{{domain}}}]
            | {{{domain}}}
          }}
        </td>
      </tr>
  }}
  {{#if:{{{website|}}}
    | <tr>
        <td style="font-weight:bold; padding:0.2em;">Website</td>
        <td style="padding:0.2em;">[{{{website}}} {{{website}}}]</td>
      </tr>
  }}
  {{#if:{{{description|}}}
    | <tr>
        <td colspan="2" style="padding:0.3em; font-size:0.9em; line-height:1.2em;">{{{description}}}</td>
      </tr>
  }}
  {{#if:{{{retired|}}}
    | <tr>
        <td style="font-weight:bold; padding:0.2em;">Retired</td>
        <td style="padding:0.2em;">{{{retired}}}</td>
      </tr>
  }}
  {{#if:{{{author|}}}
     | <tr>
        <td style="font-weight:bold; padding:0.2em;">Author</td>
        <td style="padding:0.2em;">{{{author}}}</td>
      </tr>
  }}
   {{#if:{{{version|}}}
    | <tr>
        <td style="font-weight:bold; padding:0.2em;">Version</td>
        <td style="padding:0.2em;">{{{version}}}</td>
      </tr>
  }}
</table>
 
<nowiki>
{{Infobox
| title                  = Colorful Example Infobox
| image                  = Example.jpg
| image_alt              = An example image
| image_caption          = Caption for example image
| type                  = Software Project
| date                  = 2025-07-10
| location              = Internet
| domain                = example.com
| domain_url            = https://example.com
| website                = https://example.com
| description            = This is a colorful infobox with customizable colors and width.
| retired                = No
| author                = Jane Doe
| version                = 1.0.0
| border-color          = #4A90E2
| background-color      = #E6F0FA
| title-background-color = #357ABD
| title-text-color      = #FFFFFF
| width                  = 350px
| clear                  = right
}}
</nowiki>

Latest revision as of 09:30, 10 July 2025

   Example Infobox
    An example image
Caption goes here

The content of an Infobox is just regular WikiText!

This template creates a styled infobox with customizable colors and flexible content.

Parameters

  • `title`: Title of the infobox
  • `image`: (Optional) Filename of an image (must be uploaded)
  • `image_alt`: Image alt text
  • `image_caption`: (Optional) Text shown below the image
  • `content`: The main content (use paragraphs, images, etc.)
  • `width`: CSS width (e.g., `300px`)
  • `aspect-ratio`: (Optional) CSS aspect-ratio for content box
  • `border-colour`: Border color of the box
  • `background-colour`: Background color of the title
  • `text-colour`: Text color of the title
  • `clear`: CSS `clear` property (e.g., `right`, `left`)