Template:ImageText: Difference between revisions
basic |
test? |
||
Line 3: | Line 3: | ||
>[[File:{{trim|{{{1}}}}}|{{{w|100}}}x{{{h|100}}}px|{{trim|{{{2}}}}}|link={{{link|}}}]]</div> | >[[File:{{trim|{{{1}}}}}|{{{w|100}}}x{{{h|100}}}px|{{trim|{{{2}}}}}|link={{{link|}}}]]</div> | ||
<div class="straftat-wiki-imagetext-text" style="width: {{{w|100}}}px; text-align: center; {{#if: {{{font size|}}} | font-size: {{{font size}}}; }}" | <div class="straftat-wiki-imagetext-text" style="width: {{{w|100}}}px; text-align: center; {{#if: {{{font size|}}} | font-size: {{{font size}}}; }}" | ||
>{{#if: {{{link|}}} | [[{{{link}}}|{{trim|{{{2}}}}}] | >{{#if: {{{link|}}} | {{#ifeq: {{#invoke:String|find|source={{{link}}}|target=^https?://}} | 0 | [[{{{link}}}{{!}}{{trim|{{{2}}}}}]] | [{{{link}}} {{trim|{{{2}}}}}] }} | {{trim|{{{2}}}}} }}</div> | ||
</div></includeonly><noinclude> | </div></includeonly><noinclude> | ||
This template allows you to add images on top of a piece of text. | This template allows you to add images on top of a piece of text. |
Latest revision as of 05:47, 10 December 2024
This template allows you to add images on top of a piece of text.
The element will be an inline block, meaning several can appear in one line. You can give them all a specific width and height to get a nice consistent layout.
Standard width/height is 100:
{{ImageText | AK.png | AK }} {{ImageText | GLock.png | Glock }} {{ImageText | Prophet.png | Just a test with very very long text }}
Result:

AK

Backgrounds

Just a test with very very long text
Limiting width only; note this may cause the text to overflow as seen here:
{{ImageText | AK.png | AK | w = 50 }} {{ImageText | GLock.png | Glock | w = 50 }}
Result:

AK

Glock
Limiting height only:
{{ImageText | AK.png | AK | h = 50 }} {{ImageText | GLock.pngg | Glock | h = 50 }}
Result:

AK

Glock
Limiting width and height:
{{ImageText | AK.png | AK | w = 50 | h = 50 }} {{ImageText | GLock.png | Glock | w = 50 | h = 50 }}
Result:

AK

Glock
You might have noticed the text is often too wide for the icon... You can specify a font size:
{{ImageText | AK.png | AK | w = 80 | h = 80 | font size = 80% }} {{ImageText | GLock.png | Glock | w = 80 | h = 80 | font size = 80% }}
Result:

AK

Glock