Difference between revisions of "Template:Icon"
m (Fixed?) |
m (Added trim template do make the template easier to use.) |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
− | [[File:{{{1| | + | [[File:{{{1|broken_error_image.png}}}|link={{{link|}}}|{{#if: {{{w|}}} {{{h|}}} | {{{w|}}}x{{{h|}}}px | x{{trim | {{{2|40}}} }}px }} | alt={{{caption|{{{link}}}}}} |class=icon {{{class|}}}]] |
</includeonly> | </includeonly> | ||
<noinclude> | <noinclude> | ||
Line 21: | Line 21: | ||
</pre> | </pre> | ||
− | Result: | + | Result: |
− | {{icon | Nesting_MAINPAGE.png | 30 }} | + | {{icon | Nesting_MAINPAGE.png |30 }} |
Usage: | Usage: | ||
Line 68: | Line 68: | ||
Usage: | Usage: | ||
<pre> | <pre> | ||
− | {{icon | + | {{icon | link = Nesting }} |
</pre> | </pre> | ||
Result: <br> | Result: <br> | ||
− | {{icon | + | {{icon | link = Nesting }} |
[[Category: Templates]] | [[Category: Templates]] | ||
</noinclude> | </noinclude> |
Revision as of 13:49, 24 November 2024
Usage:
{{icon | Nesting_MAINPAGE.png }}
Result:
The default size is x40px
meaning the icon is scaled until the height is 40 px.
It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
An alternative value for the height can be provided like so:
Usage:
{{icon | Nesting_MAINPAGE.png | 30 }}
Result:
Usage:
{{icon | Nesting_MAINPAGE.png | 50 }}
Result:
Alternatively you can use the named parameters w
and h
.
Note that these are max values so the more limiting one applies.
In the following example, the height value is essentially ignored because the original image is a square so the width becomes the limiting factor. (Were the original image 200 by 500, the result would be 20 by 50.)
Usage:
{{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}
Result:
You can also provide a link:
Usage:
{{icon | Nesting_MAINPAGE.png | link = Nesting }}
Result:
Caption (alt text) will be the link by default but can be changed:
Usage:
{{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}
Result:
Behavior when icon is missing:
Usage:
{{icon | link = Nesting }}
Result: