Template:Px
Revision as of 09:00, 4 June 2019 by Dinoguy1000 (talk | contribs) (Protected "Template:Px": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Usage
This template is used to help normalize image size values by ensuring input doesn't have any "px" unit at the end. It takes one or two parameters: the required first parameter is the image size value, and the optional second parameter indicates that the unit "px" should be affixed to the normalized value.
For example, {{px|180}}
and {{px|180px}}
both result in 180, and {{px|180|px}}
and {{px|180px|px}}
both result in 180px.
The template also correctly handles cases where the "px" unit has been doubled and cases where the "x" notation is used to indicate height in addition to or instead of width:
{{px|180pxpx}}
→ 180{{px|180x180}}
,{{px|180x180px}}
,{{px|180x180pxpx}}
→ 180x180{{px|x180}}
,{{px|x180px}}
,{{px|x180pxpx}}
→ x180
See also
- {{Image width}}
- wikipedia:Template:Px, a similar template on Wikipedia