Template:IconCreate: Difference between revisions
(center the icon) |
|||
Line 1: | Line 1: | ||
<onlyinclude><div style="position:relative; |
<onlyinclude><div style="position:relative; box-sizing:border-box; width:100%; height:{{{height|60}}}px;"> |
||
<!-- Background Icon --> |
<!-- Background Icon --> |
||
<div style="position:absolute;">[[File:{{#switch:{{{bg|normal}}}|normal=1x1 default bg}}.png|{{{width|60}}}px|link={{{icon|Titanium}}}]]</div> |
<div style="position:absolute; left: calc( (100% - {{{width|60}}}px) / 2 );">[[File:{{#switch:{{{bg|normal}}}|normal=1x1 default bg}}.png|{{{width|60}}}px|link={{{icon|Titanium}}}]]</div> |
||
<!-- Main Icon --> |
<!-- Main Icon --> |
||
<div style="position:absolute;">[[File:{{{icon|Red Tablet}}} NoBG.png|{{{width|60}}}px|link={{{icon|Titanium}}}]]</div> |
<div style="position:absolute; left: calc( (100% - {{{width|60}}}px) / 2 );">[[File:{{{icon|Red Tablet}}} NoBG.png|{{{width|60}}}px|link={{{icon|Titanium}}}]]</div> |
||
</div></onlyinclude> |
</div></onlyinclude> |
||
This template displays an icon by overlaying a foreground image on a background image, and centers it within the parent element. |
|||
== Parameters == |
|||
<pre> |
|||
icon = foreground image; default is "Red Tablet" |
|||
bg = background; default is "normal" |
|||
width = icon width |
|||
height = icon height |
|||
</pre> |
|||
== Example == |
|||
<pre> |
|||
{{IconCreate|icon=Uranium|bg=normal|height=60|width=60}} |
|||
</pre> |
|||
'''Result:''' |
|||
{{IconCreate|icon=Uranium|bg=normal|height=60|width=60}} |
Revision as of 01:16, 28 June 2019
This template displays an icon by overlaying a foreground image on a background image, and centers it within the parent element.
Parameters
icon = foreground image; default is "Red Tablet" bg = background; default is "normal" width = icon width height = icon height
Example
{{IconCreate|icon=Uranium|bg=normal|height=60|width=60}}
Result: