Difference between revisions of "Template:Icon"

From Beasts of Bermuda
Jump to: navigation, search
m (Testing5)
m (Added <span> class after-icon, in hopes of fixing icon formating issue. It will not show up after text.)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
 
[[File:{{{1|error.png}}}|link={{{link|Main_Page}}}|{{#if: {{{w|}}} {{{h|}}} | {{{w|}}}x{{{h|}}}px | x40px }}|alt={{{caption|{{{link| {{{1}}} }}}}}} |class=icon {{{class|}}}]]
 
<span> class="after-icon"> </span>
 
</includeonly>
 
 
<noinclude>
 
<noinclude>
Usage:
+
==Description==
<pre>
+
A Template used to insert Icons and Images in an easy way.  
    {{icon | Nesting_MAINPAGE.png }}
 
</pre>
 
 
 
Result:<br>
 
{{icon | Nesting_MAINPAGE.png }}
 
  
 +
==Usage==
 
The default size is <code>x40px</code> meaning the icon is scaled until the '''height''' is 40 px. <br>  
 
The default size is <code>x40px</code> meaning the icon is scaled until the '''height''' is 40 px. <br>  
 
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.
 
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.
 +
<br><br>
 +
Syntax:
 +
<code><nowiki>
 +
{{icon | Nesting_MAINPAGE.png }}
 +
</nowiki></code>
  
An alternative value for the height can be provided like so:
+
Result: {{icon | Nesting_MAINPAGE.png }}
 
 
Usage:
 
<pre>
 
    {{icon | Nesting_MAINPAGE.png | 30 }}
 
</pre>
 
  
Result: <br>
+
==Changing Size==
{{icon | Nesting_MAINPAGE.png | 30 }}
+
An alternative value for the height can also be provided.
 +
<br> There can however be no space between the pipebar <code>|</code> and the size.
 +
<br><br>
 +
Syntax:  
 +
<code><nowiki>
 +
{{icon | Nesting_MAINPAGE.png |30 }}
 +
</nowiki></code>
  
Usage:
+
Result: {{icon | Nesting_MAINPAGE.png |30 }}
<pre>
+
----
    {{icon | Nesting_MAINPAGE.png | 50 }}
+
<br>
</pre>
+
Syntax:
 +
<code><nowiki>
 +
{{icon | Nesting_MAINPAGE.png |50 }}
 +
</nowiki></code>
  
Result:<br>
+
Result: {{icon | Nesting_MAINPAGE.png |50 }}
{{icon | Nesting_MAINPAGE.png | 50 }}
 
  
 +
==Changing Height and Weight seperatly==
 
Alternatively you can use the named parameters <code>w</code> and <code>h</code>.  <br>  
 
Alternatively you can use the named parameters <code>w</code> and <code>h</code>.  <br>  
 
Note that these are max values so the more limiting one applies. <br>  
 
Note that these are max values so the more limiting one applies. <br>  
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.)
+
In the following example, the height value is essentially ignored because the original image is a square so the width becomes the limiting factor.  
 
+
<br>(Were the original image 200 by 500, the result would be 20 by 50.)
Usage:
+
<br><br>
<pre>
+
Syntax:
    {{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}
+
<code><nowiki>
</pre>
 
 
 
Result:<br>
 
 
{{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}
 
{{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}
 +
</nowiki></code>
  
You can also provide a link:
+
Result: {{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}
 
 
Usage:
 
<pre>
 
    {{icon | Nesting_MAINPAGE.png | link = Nesting }}
 
</pre>
 
  
Result: <br>
+
==Linking Page==
 +
You can also provide a link.
 +
<br><br>
 +
Syntax:  
 +
<code><nowiki>
 
{{icon | Nesting_MAINPAGE.png | link = Nesting }}
 
{{icon | Nesting_MAINPAGE.png | link = Nesting }}
 +
</nowiki></code>
  
Caption (alt text) will be the link by default but can be changed:
+
Result: {{icon | Nesting_MAINPAGE.png | link = Nesting }}
 
 
Usage:  
 
<pre>
 
    {{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}
 
</pre>
 
  
Result: <br>
+
==Adding Caption==
 +
The Caption (alt text) will be the link by default but can be changed.
 +
<br><br>
 +
Syntax:  
 +
<code><nowiki>
 
{{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}
 
{{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}
 +
</nowiki></code>
  
Behavior when icon is missing:
+
Result: {{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}
  
Usage:  
+
==Missing Image==
<pre>
+
Should the image be missing, the following will be displayed:
    {{icon | Missing Filename 123.png | link = Nesting }}
+
<br><br>
</pre>
+
Syntax:  
 +
<code><nowiki>
 +
{{icon | link = Nesting }}
 +
</nowiki></code>
  
Result: <br>
+
Result: {{icon | link = Nesting }}
{{icon | Missing Filename 123.png | link = Nesting }}
 
  
Drop shadow:
+
[[Category: Templates]]
<pre>
 
    {{icon | Nesting_MAINPAGE.png | class = lightmode-drop-shadow }}
 
</pre>
 
 
 
{{icon | Nesting_MAINPAGE.png | class = lightmode-drop-shadow }}
 
 
 
[[Category:Icon templates]]
 
 
</noinclude>
 
</noinclude>
  
[[Category: Templates]]
+
<includeonly>
 +
[[File:{{{1|broken_error_image.png}}}|link={{{link|}}}|{{#if: {{{w|}}} {{{h|}}} | {{{w|}}}x{{{h|}}}px | x{{{2|40}}}px }} | alt={{{caption|{{{link}}}}}} |class=icon {{{class|}}}]]<span class="after-icon"></span>
 +
</includeonly>

Latest revision as of 16:29, 24 November 2024

Description

A Template used to insert Icons and Images in an easy way.

Usage

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.

Syntax: {{icon | Nesting_MAINPAGE.png }}

Result:


{{{link}}}


Changing Size

An alternative value for the height can also be provided.
There can however be no space between the pipebar | and the size.

Syntax: {{icon | Nesting_MAINPAGE.png |30 }}

Result:


{{{link}}}



Syntax: {{icon | Nesting_MAINPAGE.png |50 }}

Result:


{{{link}}}


Changing Height and Weight seperatly

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.)

Syntax: {{icon | Nesting_MAINPAGE.png | w = 20 | h = 50 }}

Result:


{{{link}}}


Linking Page

You can also provide a link.

Syntax: {{icon | Nesting_MAINPAGE.png | link = Nesting }}

Result:


Nesting


Adding Caption

The Caption (alt text) will be the link by default but can be changed.

Syntax: {{icon | Nesting_MAINPAGE.png | link = Nesting | caption = Blah }}

Result:


Blah


Missing Image

Should the image be missing, the following will be displayed:

Syntax: {{icon | link = Nesting }}

Result:


Nesting