Jump to content

Template:Nowrap/doc

From Wikipedia

{{Nowrap}} or {{nowrap}} dey stop wrapping of some specific text (wey fit dey inside link too). Use this template small-small, no overuse am. E dey stop words from breaking to new line for spaces, hyphens ("-"), or sometimes parentheses depending on the browser. The size of the text wey no fit wrap become the smallest width wey that paragraph need, and this fit make the page no adjust well for small screens or different ways people dey view the content.

If you want the opposite thing wey {{nowrap}} dey do, you fit use {{wbr}}. For more information about how wrapping and breaking sentences work, check Wikipedia:Line-break handling.

{{Nowrap|these words stay together}} → these words stay together
{{Nowrap|a, b, c, or d.}} → a, b, c, or d.
{{Nowrap| merry-go-round }} → merry-go-round
{{Nowrap| [[Four-part harmony]] }} → Four-part harmony
{{Nowrap| [[Cascading Style Sheets|CSS]] }} → CSS
{{Nowrap| [[#Examples|Examples section]] }} → Examples section
{{Nowrap}} → {{{1}}}
{{Nowrap|A very long sentence that should wrap when the window becomes smaller but which is prevented from wrapping by this template, which prevents normal line wrapping of long strings that are wrapped in the template.}} → A very long sentence that should wrap when the window becomes smaller but which is prevented from wrapping by this template, which prevents normal line wrapping of long strings that are wrapped in the template.

Examples

[edit source]
"They held {{Nowrap|10 kg (22 lb)}} in total."


E fit show like this:

They held 10 kg (22 lb)
in total.


Or e fit show like this:

They held
10 kg (22 lb) in total.


But e no go show like this:

They held 10 kg (22
lb) in total.
"He encountered {{Nowrap|a tiger}} in the woods."


E fit show like this:

He encountered a tiger
in the woods.


Or e fit show like this:

He encountered
a tiger in the woods.


But e no go show like this:

He encountered a
tiger in the woods.

Controlling line-breaking in infoboxes

[edit source]

You fit use this template together with {{Wbr}} and {{Spaces}} to control how lines dey break inside bulletless lists for infoboxes, so long entries wey wrap no go look like different entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for more details.

Handling equal-sign or bar

[edit source]

Templates get problem when parameter data contain equal-sign "=" or vertical bars "|" (pipes). Note say this no apply if the equal-sign "=" or vertical bar "|" dey inside wikilink or another template. If you get bare equal-sign "=" or vertical bar "|", you fit use {{Nowrap begin}} + {{Nowrap end}} instead. But there be other ways too:

For text wey get equal-sign "=", put 1= before the text, use triple-brace unnamed parameter {{{|=}}}, or use the {{=}} magic word. Example:

{{Nowrap|1=2 + 2 = 4}},
{{Nowrap|2 + 2 {{{|=}}} 4}}, or
{{Nowrap|2 + 2 {{=}} 4}}

All of them go render like this:

2 + 2 = 4.

For text wey get vertical bar "|", escape the bar(s) with "|" or "{{pipe}}" or "{{abs}}". Example, if you want put two bars "|6|" like this:

{{Nowrap|&#124;6&#124; < 7}}  or  {{Nowrap|{{pipe}}6{{pipe}} < 7}}  or  {{Nowrap|{{abs|6}} < 7}}

E go render like this:

|6| < 7

Technical details

[edit source]

The actual code wey dey do the work na this HTML <span> tag wey apply one class to the text inside the template:

<span class="nowrap">This text will not wrap</span>

The class nowrap receive the CSS property white-space: nowrap; inside MediaWiki:Common.css.

TemplateData

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

TemplateData for Nowrap

E dey stop words from breaking to new lines (line breaks) inside text or inside a link wey get spaces or hyphens (-).

Template parameters

ParameterDescriptionTypeStatus
Text1

Text or link wey need protection.

Stringrequired

See also

[edit source]

Template:List of nowrap-like templates