Template:Resize/doc: Difference between revisions

From escforumwiki
Jump to navigation Jump to search
Santos (talk | contribs)
m 1 revision imported
 
en>Jonesey95
→‎See also: add link to smalldiv
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Please add categories at the bottom of this page, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
{{When pagename is
{{When pagename is
  | Template:Resize/doc = {{Resize/doc/main}}
  | Template:Resize/doc = {{High-use}} {{COinS safe|n}} {{Resize/doc/main}}
  | Template:Resize/sandbox = {{Resize/doc/main}}
  | Template:Resize/sandbox = {{Resize/doc/main}}
  | Template:Resize = {{High-risk| 115,000+ }} {{COinS safe|n}} {{Resize/doc/main}}
  | Template:Resize = {{High-use}} {{COinS safe|n}} {{Resize/doc/main}}
| Template:Resize shortcuts documentation = <div style="margin:0.5em 0;">This template is a tailored shortcut to {{tl|resize}}.</div>
  | /doc = <div style="margin:0.5em 0;">This template is a tailored shortcut to {{tl|resize}}.</div>
  | /doc = <div style="margin:0.5em 0;">This template is a tailored shortcut to {{tl|resize}}.</div>
  | other = {{COinS safe|n}} <div style="margin:0.5em 0;">This template is a tailored shortcut to {{tl|resize}}.</div>
  | other = {{COinS safe|n}} <div style="margin:0.5em 0;">This template is a tailored shortcut to {{tl|resize}}.</div>
}} <!-- PLEASE ADD CATEGORIES WHERE INDICATED BELOW -->
}}


== Tailored shortcuts ==
== Comparison ==
{{Resize shortcuts}}
{{Resize shortcuts}}
{{Font size templates}}


== See also ==
== See also ==
{{font size templates}}
* [[:Category:Resizing templates]]
* {{tl|smalldiv}}, for wrapping multiple lines of text that cause syntax errors when wrapped by {{tl|resize}} or {{tl|small}}
* [https://developer.mozilla.org/en-US/docs/Web/CSS/font-size font-size - CSS: Cascading Style Sheets | Mozilla Developer Network]
 
{{Resize/TemplateData}}


<includeonly>{{When pagename is
<includeonly>{{When pagename is
| Template:Resize = <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
| Template:Resize = {{sandbox other||
<!-- Add categories below this line, and interwikis at Wikidata -->
[[Category:Resizing templates| ]]
[[Category:Resizing templates| ]]
[[Category:TemplateData documentation with overload problems]]
[[Category:TemplateData documentation with overload problems]]
}}
}}</includeonly>
}}</includeonly>

Revision as of 00:07, 9 October 2021

It is to change the font size of a text string.

Usage

  • {{resize|N|text}}N specifies a size, such as "95%", "1.2em", etc.
  • {{resize|text}} — If N is omitted, as in the second line above, a default 90% size is applied.
  • {{resize|div=yes|text}} — As above but uses a div tag instead of a span tag.

Beware

Beware that if text happens to contain an equality sign (=), it will fail to render properly. Here are the workarounds:

  1. Replace all instances of = with {{=}}, or
  2. Specify {{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:

  1. Use, for example,
    <div style="font-size:90%;">
    ...multiple paragraphs...
    </div>, or
  2. Apply this template separately to each block of paragraph, bullet point etc.
  3. Use {{resize|div=yes}}.
  4. Use {{smalldiv}}.

Examples

Code Result
{{resize|This text defaults to 90% normal size.}} This text defaults to 90% normal size.
{{resize|80%|This text is 80% normal size.}} This text is 80% normal size.
{{resize|1.2em|This text is 0.2em larger than normal.}} This text is 0.2em larger than normal.
{{resize|We know 1+1=2 and 2+2=4. It will fail to render}} {{{1}}}
{{resize|We know 1+1{{=}}2 and 2+2{{=}}4.}} We know 1+1=2 and 2+2=4.
{{resize|1=We know 1+1=2 and 2+2=4.}} We know 1+1=2 and 2+2=4.
{{resize|120%|2=We know 1+1=2 and 2+2=4. This text is 120% normal size.}} We know 1+1=2 and 2+2=4. This text is 120% normal size.

Comparison

List of Resize Shortcuts
Code Equivalent Result
{{larger|text}} {{resize|110%|text}} text
{{large|text}} {{resize|large|text}} text
Font size templates
Code Size Semantics Result
{{small|text}}
{{smaller|text}}
85% <small> text
{{resize|text}} 90% none text
{{midsize|text}} 92% none text
none 100% none text
{{larger|text}} 110% none text
{{big|text}} 120% <big> text
{{large|text}} 125% none text
{{huge|text}} 180% none text
{{resize|x%}} custom none varies
{{font|size=x%}} custom none varies

See also

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Resize in articles based on its TemplateData.

TemplateData for Resize

It is to change the font size of a text string. Two forms {{resize|<size>|<text>}} and {{resize|<text>}} are possible.

Template parameters

ParameterDescriptionTypeStatus
Size/Text1

Specifies a css font size e.g. '80%', '1.2em', 'x-large', 'larger'. In the one parameter version the first parameter is the text and the font size is '90%'.

Stringrequired
Text when size is given2

The text to display in the two parameter version.

Stringoptional
Use div tagdiv

Set to yes to use a div instead of a span tag.

Stringoptional