模板:Spaces
<templatestyles src="Module:Documentation/styles.css"></templatestyles>
| 文件:Stop hand nuvola.svg | This template should not be used in citation templates such as Citation Style 1 and Citation Style 2, because it includes markup that will pollute the COinS metadata they produce; see Wikipedia:COinS. |
| Warning | This template is used on approximately 3,200,000 pages, or roughly 208333% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
| 文件:Lua-logo-nolabel.svg | 此模板使用Lua语言: |
A template to produce one or more non-breaking spaces ( character entities).
Usage
Syntax
{{spaces|N|type}} produces N consecutive non-breaking spaces (where N is a whole number larger than zero) of the type specified by the second parameter (which are ordered by decreasing space width): em, fig, en, thin, hair. If type is not specified, N non-breaking spaces (<syntaxhighlight inline lang=xml> </syntaxhighlight>) are produced. A non-breaking space has the same width as a standard space, whose width is between the width of en and thin.
{{spaces|type}} produces a single non-breaking space of the type indicated.
Controlling line-breaking in infoboxes
This template, usually as its alias {{nbsp}}, may be used with {{wbr}} and {{nowrap}} to control line-breaking in bulletless lists in infoboxes, to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.
Comparisons
| Name (alias) |
→Instance← |
Example code and ... | Using {{spaces}} | Output | Output {{spaces}} |
|---|---|---|---|---|---|
| none | →← |
<syntaxhighlight lang="html" inline="">Text[1]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text[2]</syntaxhighlight> |
Text[1] Text[2] |
||
| Hair (Very thin) |
→ ←
|
<syntaxhighlight lang="html" inline="">Text [3]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text [4]</syntaxhighlight> |
Text{{spaces|hair}}<ref>...</ref>
|
Text [1] Text [2] |
Text [1] Text [2] |
| 2-pixel | →←
|
<syntaxhighlight lang="html" inline="">Text[5]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text[6]</syntaxhighlight> |
Text[1] Text[2] |
||
| Narrow no-break | → ←
|
<syntaxhighlight lang="html" inline="">Text [7]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text [8]</syntaxhighlight> |
Text [1] Text [2] |
||
| Thin | → ←
|
<syntaxhighlight lang="html" inline="">Text [9]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text [10]</syntaxhighlight> |
Text{{spaces|thin}}<ref>...</ref>
|
Text [1] Text [2] |
Text [1] Text [2] |
| Standarda | → ←
|
<syntaxhighlight lang="html" inline="">Text [11]</syntaxhighlight> <syntaxhighlight lang="html" inline="">Text [12]</syntaxhighlight> |
Text{{spaces}}<ref>...</ref>
|
Text [1] | Text [1] Text [2] |
| En | → ←
|
<syntaxhighlight lang="html" inline="">1 3</syntaxhighlight> | 1{{spaces|en}}3
|
1 3 | 1 3 |
| Figure | → ←
|
<syntaxhighlight lang="html" inline="">123 1 3</syntaxhighlight> |
123<br/>1{{spaces|fig}}3
|
123 1 3 |
123 1 3 |
| Em | → ←
|
<syntaxhighlight lang="html" inline="">1 3</syntaxhighlight> | 1{{spaces|em}}3
|
1 3 | 1 3 |
Template data
TemplateData for Spaces
Inserts one or more non-breaking spaces
| 参数 | 描述 | 类型 | 状态 | |
|---|---|---|---|---|
| Quantity | 1 | How many non-breaking spaces to insert
| 数字 | 可选 |
| Type | 2 | Non-default types (in decreasing order of width): em, fig, en, thin, hair
| 字符串 | 可选 |
See also
- Template:Non breaking hyphen
- Help:Advanced text formatting
- {{0}} to add invisible characters
- {{block indent}} to indent an entire block of content, similar to a block quotation (uses
<div>and CSS margins) - {{nowrap|item}} to stop the linewrapping of any part of item