Template:Icon: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<includeonly>[[File:{{{1}}}|frameless|middle|link=|x{{{2|40}}}px]]</includeonly><noinclude> Usage: {{code|<nowiki>{{icon|Flourish.jpg}}</nowiki>}} Result: {{icon|Flourish.jpg}} </noinclude>") |
HiddenDragon (talk | contribs) (Template demo) |
||
(23 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly>[[File:{{{1}}}| | <includeonly>[[File:{{trim | {{{1}}} }}|link={{{link|}}}|{{#if: {{{w|}}}{{{h|}}} | {{{w|}}}x{{{h|}}}px | x{{trim | {{{2|40}}} }}px }}|alt={{{caption|{{{link|{{{1}}} }}}}}}|class=bg3wiki-icon {{{class|}}}]]<span class="bg3wiki-after-icon"></span></includeonly><noinclude> | ||
{{documentation|content= | |||
Displays an icon. | |||
{{Template demo | |||
| list = table | |||
| <nowiki>{{icon | Flourish Icon.png }}</nowiki> | |||
}} | |||
The default size is {{code|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: | |||
{{Template demo | |||
| list = table | |||
| <nowiki>{{icon | Flourish Icon.png | 30 }}</nowiki> | |||
| <nowiki>{{icon | Flourish Icon.png | 50 }}</nowiki> | |||
}} | |||
Alternatively you can use the named parameters {{code|w}} and {{code|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.) | |||
{{Template demo | |||
| list = table | |||
| caption 1 = Width and height | |||
| <nowiki>{{icon | Flourish Icon.png | w = 20 | h = 50 }}</nowiki> | |||
| caption 2 = With a link | |||
| <nowiki>{{icon | Flourish Icon.png | link = Flourish }}</nowiki> | |||
| caption 3 = With alt text | |||
| <nowiki>{{icon | Flourish Icon.png | link = Flourish | caption = Blah }}</nowiki> | |||
| caption 4 = Missing icon | |||
| <nowiki>{{icon | Missing Filename 123.png | link = Flourish }}</nowiki> | |||
| caption 5 = Drop shadow | |||
| <nowiki>{{icon | Flourish Icon.png | class = bg3wiki-lightmode-drop-shadow }}</nowiki> | |||
}} | |||
}} | |||
[[Category:Templates]] | |||
[[Category:Icon templates]] | |||
</noinclude> | </noinclude> |
Latest revision as of 12:15, 19 January 2025
Template documentation
Displays an icon.
Markup | Renders as |
---|---|
{{icon | Flourish Icon.png }} | ![]() |
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:
Markup | Renders as |
---|---|
{{icon | Flourish Icon.png | 30 }} | ![]() |
{{icon | Flourish Icon.png | 50 }} | ![]() |
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.)
Example | Markup | Renders as |
---|---|---|
Width and height | {{icon | Flourish Icon.png | w = 20 | h = 50 }} | ![]() |
With a link | {{icon | Flourish Icon.png | link = Flourish }} | ![]() |
With alt text | {{icon | Flourish Icon.png | link = Flourish | caption = Blah }} | ![]() |
Missing icon | {{icon | Missing Filename 123.png | link = Flourish }} | File:Missing Filename 123.png |
Drop shadow | {{icon | Flourish Icon.png | class = bg3wiki-lightmode-drop-shadow }} | ![]() |