Template:Pad/doc

From Embroidery Machine WIKI
Jump to navigation Jump to search

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

         | {{
 {{#invoke:Namespace detect|main}}

| type = notice | image = File:Edit-copy green.svg | imageright = | class = | style = margin-bottom:1.0em; | textstyle = | text = This is a documentation subpage for Template:Pad.
It contains usage information, categories and other content that is not part of the original {{#if: |{{{text2}}} |{{#if: |{{{text1}}} |{{#ifeq:Template |User |template template page |{{#if:Template |template page|article}}}}}}}}. | small = | smallimage = | smallimageright = | smalltext = | subst = | date = | name = }}

        }}{{#if: |
         |   {{#ifexist:Template:Pad
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}
        }}
    | 
   }}


Usage

Use {{Pad}} to insert a horizontally padding HTML {{#switch:open

|c|close  = 
|s|single
|o|open
|p|pair   = <span{{#if:| {{{params}}}}}

}}{{#switch:open

|c|close  = 
|s|single =  />
|o|open   = >
|p|pair   = >...

}}{{#switch:open

|s|single
|o|open   = 
|c|close
|p|pair   = </span>

}} inline. The template takes one unnamed parameter; a width value specified in px, em or ex (other CSS units – in, cm, pc, pt – are supported as well, but not recommended, typically at 96dpi conversion ratio). The default is 1 em.

The result is the specified padding followed by an &nbsp; (non-breaking space – at 100% font size (8pt), typically 3px wide in narrow fonts like Arial and Tahoma, 4px in wider fonts like Arial Black and Verdana).

Examples

Indenting by 50 pixels plus an &nbsp; (53px in Arial):

  • Indenting 50px causes<br />{{pad|50px}}this amount of space.

Produces:

  • Indenting 50px causes
     this amount of space.


Width of a typical year-range in Arial font (4.8em plus an &nbsp;):

  • 1492–1540 Exploration by<br />{{pad|4.8em}}Columbus & others.

Produces:

  • 1492–1540 Exploration by
     Columbus & others.


However, some digits require less space:

  • 1111–1117 Exploration by<br />{{pad|4.4em}}Explorer Bob.

Produces:

  • 1111–1117 Exploration by
     Explorer Bob.


Spacing is, of course, different between fonts, too:

  • {{#if: This is text 0123456789 in Arial
     and this is indented by 100px + 1 &nbsp;
     and this is indented by 9em + 1 &nbsp; |This is text 0123456789 in Arial
     and this is indented by 100px + 1 &nbsp;
     and this is indented by 9em + 1 &nbsp;|{{{text}}}}}

  • {{#if: This is text 0123456789 in Times New Roman
     and this is indented by 100px+ 1 &nbsp;
     and this is indented by 9em + 1 &nbsp; |This is text 0123456789 in Times New Roman
     and this is indented by 100px+ 1 &nbsp;
     and this is indented by 9em + 1 &nbsp;|{{{text}}}}}

  • {{#if: This is text 0123456789 in Arial Black
     and this is indented by 100px + 1 &nbsp;
     and this is indented by 9em + 1 &nbsp; |This is text 0123456789 in Arial Black
     and this is indented by 100px + 1 &nbsp;
     and this is indented by 9em + 1 &nbsp;|{{{text}}}}}

  • {{#if: This is text 0123456789 in Lucida Console
     and this is indented by 100px+ 1 &nbsp;
     and this is indented by 9em + 1 &nbsp; |This is text 0123456789 in Lucida Console
     and this is indented by 100px+ 1 &nbsp;
     and this is indented by 9em + 1 &nbsp;|{{{text}}}}}

Note: 1em is typically 11.2px at 100% font size (8 point), 21.3px at 200% font size (16 point), and 32px at 300% font size (24pt).

See also

  • {{{{#if: |subst:}}spaces{{#if:n ||n}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||}}}} - to space by a few spaces, such as {{spaces|7}}
  • {{{{#if: |subst:}}in5{{#if:n ||n}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||}}}} - to space by 1-to-n spaces, such as {{in5|29}}
  • {{{{#if: |subst:}}gapsize{{#if:n ||n}}{{#if:x ||x}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||}}}} - to space by 1-to-n spaces