Difference between revisions of "Template:Px"
m (Added categorization) |
m (Added clear templates for clarity.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
|{{{3|}}}{{#iferror:{{#expr:{{{3|}}}>0}}||px}} | |{{{3|}}}{{#iferror:{{#expr:{{{3|}}}>0}}||px}} | ||
}} | }} | ||
}}<noinclude>{{usage|1=This is a metatemplate used to define the size parameters in other templates. | |||
The format for using this template is as follows:<br /> | |||
'''<pre>{{Px|40px}}</pre>''' | |||
- Displays:{{Px|40px}} | |||
'''<pre>{{Px|40}}</pre>''' | |||
- Displays: {{Px|40}} | |||
The advantage of the Px template is that you can have extra pipes between the "Px" and the number, so you can set your template to have a default size if the user does not specify. For example, the thumbnails below each use the Px Template to set a default size of 100 pixels. | |||
*<nowiki>[[Image:I_am_not_Gay.jpg | {{px| {{{width|}}} | 100 }} | thumb|A ]]</nowiki> | |||
Thumbnail A has no width specified, so the thumb defaults to 100 pixels. | |||
[[Image:I_am_not_Gay.jpg | {{px| {{{width|}}} | 100 }} | thumb|A ]] | |||
{{clear}} | |||
*<nowiki>[[Image:I_am_not_Gay.jpg | {{px| {{{width|200}}} | 100 }} | thumb|B ]]</nowiki> | |||
Thumbnail B has a width of 200 pixels specified, so the default size is ignored. | |||
[[Image:I_am_not_Gay.jpg | {{px| {{{width|200}}} | 100 }} | thumb|B ]] | |||
{{clear}} | |||
*<nowiki>[[Image:sonichu.jpg | {{px| {{{width|50}}} | 100 }} | thumb|C ]]</nowiki> | |||
Thumbnail C has a width of 50 pixels specified, so the default size is ignored. | |||
[[Image:I_am_not_Gay.jpg | {{px| {{{width|50}}} | 100 }} | thumb|C ]] | |||
{{clear}} | |||
}} | }} | ||
[[Category: | |||
[[Category:Metatemplates|{{PAGENAME}}]]</noinclude> |
Latest revision as of 22:14, 3 February 2011
Usage
These usage notes will not be included in articles bearing this template.
This is a metatemplate used to define the size parameters in other templates.
The format for using this template is as follows:
{{Px|40px}}
- Displays:40px
{{Px|40}}
- Displays: 40px
The advantage of the Px template is that you can have extra pipes between the "Px" and the number, so you can set your template to have a default size if the user does not specify. For example, the thumbnails below each use the Px Template to set a default size of 100 pixels.
- [[Image:I_am_not_Gay.jpg | {{px| {{{width|}}} | 100 }} | thumb|A ]]
Thumbnail A has no width specified, so the thumb defaults to 100 pixels.
- [[Image:I_am_not_Gay.jpg | {{px| {{{width|200}}} | 100 }} | thumb|B ]]
Thumbnail B has a width of 200 pixels specified, so the default size is ignored.
- [[Image:sonichu.jpg | {{px| {{{width|50}}} | 100 }} | thumb|C ]]
Thumbnail C has a width of 50 pixels specified, so the default size is ignored.