Template:Resize/doc
This is a documentation subpage for Template:Resize It contains usage information, categories and other content that is not part of the original template page. |
This template is used on 140+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
The {{Resize}}
template is used to change the font size of the text supplied to it. It is primarily intended for text strings within a single paragraph or list item, but can also be configured for use with entire lists or text which spans multiple paragraphs.
Usage
edit{{Resize|N|text}} | N specifies a valid CSS length unit. This can be relative, such as 2vw (2% of the page width) or 1.2rem (120% of the browser's default text size), or absolute, as in 14px (14 device pixels) or 2pc (2 pica, or 24 device pixels).
|
{{Resize|text}} | Here, where no size is specified, a fallback value of 1.67vw is applied, unless that exceeds a minimum of 0.9rem or maximum of 0.98rem, in which case those values are used instead. |
{{Resize|text|div=yes}} | The text is resized as described in the previous example, but wrapped in block element tags rather than inline, permitting the use of paragraphs separated by empty lines. |
Limitations
editBeware that if text happens to contain an equality sign or signs (=), it will fail to render properly. Here are the workarounds:
- Use the named parameter
|text=
instead of supplying the content as an unnamed parameter, as in{{Resize|text=text}}
. - Replace all instances of
=
with{{=}}
. - Specify your text using positional parameters, as in
{{Resize|N|2=text}}
or{{Resize|1=text}}
.
Also it will fail to wrap multiple blocks, such as multiple paragraphs or multiple bullet points. Here are the workarounds:
- Use {{Resize|…|div=yes}}, or
- Apply this template separately to each paragraph or list item using only the first one or two parameters, or
- Indulge in some wiki-nostalgia and wrap it all in div tags by hand, as in
<div style="font-size:90%;">
...multiple paragraphs...</div>
.
Examples
editWikicode | Result |
---|---|
{{Resize|This text uses the fallback character size reduction appropriate to the device viewing it.}} | This text uses the fallback character size reduction appropriate to the device viewing it.
(123% of the page width or the bounding values of 90%/98% of the browser's default text size) |
{{Resize|0.8rem|This text is 80% of the browser's default text size.}} | This text is 80% of the browser's default text size. |
{{Resize|1.2rem|This text is 20% larger than the browser's default text size.}} | This text is 20% larger than the browser's default text size. |
{{Resize|We know 1+1=2 and 2+2=4 will fail to render because of the equality signs.}} | {{{1}}} |
{{Resize|We know 1+1{{=}}2 and 2+2{{=}}4.}} | We know 1+1=2 and 2+2=4. |
{{Resize|text=We know 1+1=2 and 2+2=4.}} | We know 1+1=2 and 2+2=4. |
{{Resize|size=1.25rem|2=We know 1+1=2 and 2+2=4. This text is 25% larger than the browser's default text size.}} | We know 1+1=2 and 2+2=4. This text is 25% larger than the browser's default text size. |
TemplateData
editTemplateData for Resize
Uses inline CSS font-size property within <div> or <span> tags to alter the size of the text supplied to it
Parameter | Description | Type | Status | |
---|---|---|---|---|
Font size | size | A valid CSS length value, absolute or relative
| Line | suggested |
text | text | no description | Unknown | optional |
div | div | no description | Unknown | optional |
1 | 1 | no description | Unknown | optional |
2 | 2 | no description | Unknown | optional |
See also
edit