Jump to content

Template:Resize/doc/main: Difference between revisions

From escforumwiki
Santos (talk | contribs)
m 1 revision imported
 
en>WOSlinker
Line 1: Line 1:
A template to aid switching the font-size used for a text string.
<div>{{view|Template:Resize/doc/main|edit|brackets=yes}} It is to change the font size of a text string.</div>


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


If <code>''text''</code> happens to contain an equality sign ("="), specify {{tlf|resize|''N''|'''2&#61;'''''text''}} or {{tlf|resize|'''1&#61;'''''text''}}.  
=== Beware ===
'''{{red|Beware}}''' that if <code>''text''</code> happens to contain an equality sign (<code>=</code>), it will fail to render properly. Here are the workarounds:
# Replace '''all''' instances of <code>=</code> with {{tlx|{{=}}}}, or
# Specify <code>{{tlf|resize|''N''|'''2&#61;'''''text''}}</code> or <code>{{tlf|resize|'''1&#61;'''''text''}}</code>.
 
Also it will fail to wrap multiple blocks, such as multiple paragraphs or multiple bullet points. Here are the workarounds:
# Use, for example, <br/><code>&lt;div style="font-size:90%;"></code><br/>...''multiple paragraphs''...<br/><code>&lt;/div></code>, or
# Apply this template separately to each block of paragraph, bullet point etc.
# Use {{tlf|resize|2=div=yes}}.
# Use {{tl|smalldiv}}.


== Examples ==
== Examples ==
{|
{| class="wikitable"
|-
! Code !! Result
|-
|-
| style="padding-right:2em"| {{tc|resize|1.2em|This text is 0.2em larger than normal.}} || {{resize|1.2em|This text is 0.2em larger than normal.}}
| {{tc|resize|This text defaults to 90% normal size.}} || {{resize|This text defaults to 90% normal size.}}
|-
|-
| {{tc|resize|80%|This text is 80% normal size.}} || {{resize|80%|This text is 80% normal size.}}
| {{tc|resize|80%|This text is 80% normal size.}} || {{resize|80%|This text is 80% normal size.}}
|-
|-
| {{tc|resize|This text defaults to 90% normal size.}} || {{resize|This text defaults to 90% normal size.}}
| {{tc|resize|1.2em|This text is 0.2em larger than normal.}} || {{resize|1.2em|This text is 0.2em larger than normal.}}
|-
| <code><nowiki>{{resize|We know 1+1=2 and 2+2=4. It will fail to render}}</nowiki></code> || {{resize|We know 1+1=2 and 2+2=4. It will fail to render}}
|-
| <code><nowiki>{{resize|We know 1+1{{=}}2 and 2+2{{=}}4.}}</nowiki></code> || {{resize|We know 1+1{{=}}2 and 2+2{{=}}4.}}
|-
| <code><nowiki>{{resize|1=We know 1+1=2 and 2+2=4.}}</nowiki></code> || {{resize|1=We know 1+1=2 and 2+2=4.}}
|-
| <code><nowiki>{{resize|120%|2=We know 1+1=2 and 2+2=4. This text is 120% normal size.}}</nowiki></code> || {{resize|120%|2=We know 1+1=2 and 2+2=4. This text is 120% normal size.}}
|}
|}

Revision as of 18:07, 10 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.
MediaWiki spam blocked by CleanTalk.