yoohoo! hot sauce please
10:27, 7 September 2026 (UTC)
Editing
Template:Nowrap/doc
From 2swagg wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} <!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]) --> {{used in system|in [[MediaWiki:Histlegend]]}} {{cascade-protected template}} {{COinS safe|n}} {{tsh|nobr|nobreak|nwr|nbr}} {{tlx|Nowrap}} or {{tlx|nowrap}} stops [[Line wrap and word wrap|wrapping]] of specific text (which can be inside of a link). Use this template '''sparingly'''. It prevents word wraps (line breaks) that might otherwise happen at spaces, hyphens ("-"), or, in some browsers, parentheses. The size of the nowrapped text becomes the minimum width of that paragraph and that can negatively influence the ability of the page to adapt to smaller screens, or alternate representations of the content. To achieve the opposite effect of <code>{{nowrap}}</code>, you can use {{tlx|wbr}}. For more information about wrapping and breaking sentences, see [[Wikipedia:Line-break handling]]. == Usage == : <syntaxhighlight lang="wikitext" inline>{{Nowrap|these words stay together}}</syntaxhighlight> → {{Nowrap|these words stay together}} : <syntaxhighlight lang="wikitext" inline>{{Nowrap|a, b, c, or d.}}</syntaxhighlight> → {{Nowrap|a, b, c, or d.}} : <syntaxhighlight lang="wikitext" inline>{{Nowrap| merry-go-round }}</syntaxhighlight> → {{Nowrap| merry-go-round }} : <syntaxhighlight lang="wikitext" inline>{{Nowrap| [[Four-part harmony]] }}</syntaxhighlight> → {{Nowrap| [[Four-part harmony]] }} : <syntaxhighlight lang="wikitext" inline>{{Nowrap| [[Cascading Style Sheets|CSS]] }}</syntaxhighlight> → {{Nowrap| [[Cascading Style Sheets|CSS]] }} : <syntaxhighlight lang="wikitext" inline>{{Nowrap| [[#Examples|Examples section]] }}</syntaxhighlight> → {{Nowrap| [[#Examples|Examples section]] }} : <syntaxhighlight lang="wikitext" inline>{{Nowrap}}</syntaxhighlight> → {{Nowrap}} : <syntaxhighlight lang="wikitext" inline>{{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.}}</syntaxhighlight> → {{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.}} === Examples === {| class=wikitable |"<code>They held {{tlc|Nowrap|10 kg (22 lb)}} in total.</code>" <br/> May render like this: :They held {{Nowrap|10 kg (22 lb)}} <br/>in total. <br/> Or like this: :They held <br/>10 kg (22 lb) in total. <br/> But ''not'' render like this: :They held 10 kg (22 <br/>lb) in total. | "<code>He encountered {{tlc|Nowrap|a tiger}} in the woods.</code>" <br/> May render like this: :He encountered a tiger <br/>in the woods. <br/> Or like this: :He encountered <br/>a tiger in the woods. <br/> But ''not'' like this: :He encountered a <br/>tiger in the woods. |} === Controlling line-breaking in infoboxes === This template may be used with {{tlx|Wbr}} and {{tlx|Spaces}} 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. === Handling equal-sign or bar === [[Help:Template|Templates]] have problems with parameter data that contains [[equal-sign]]s "<code>=</code>" or vertical bars "<code>|</code>" (pipes). Note that this does not apply if the equal-sign "<code>=</code>" or vertical bar "<code>|</code>" is inside a wikilink or another template. In the case that there is a bare equal-sign "<code>=</code>" or vertical bar "<code>|</code>", consider using {{tl|Nowrap begin}} + {{tl|Nowrap end}} instead. However, there are also other workarounds: For text that includes an equal-sign "=", precede the text with <code>1=</code>, use a triple-brace unnamed parameter <syntaxhighlight lang="wikitext" inline>{{{|=}}}</syntaxhighlight>, or the <syntaxhighlight lang="wikitext" inline>{{=}}</syntaxhighlight> magic word. For example: :<syntaxhighlight lang="wikitext" inline>{{Nowrap|1=2 + 2 = 4}}</syntaxhighlight>, <br /><syntaxhighlight lang="wikitext" inline>{{Nowrap|2 + 2 {{{|=}}} 4}}</syntaxhighlight>, or <br /><syntaxhighlight lang="wikitext" inline>{{Nowrap|2 + 2 {{=}} 4}}</syntaxhighlight> which all render as this: :{{Nowrap|1=2 + 2 = 4}}. For text that includes a vertical bar "|", escape the bar(s) with "<syntaxhighlight lang="wikitext" inline>|</syntaxhighlight>" or "<syntaxhighlight lang="wikitext" inline>{{pipe}}</syntaxhighlight>" or "<syntaxhighlight lang="wikitext" inline>{{abs}}</syntaxhighlight>". For instance, put two bars "|6|" like this: :<syntaxhighlight lang="wikitext" inline>{{Nowrap||6| < 7}}</syntaxhighlight> or <syntaxhighlight lang="wikitext" inline>{{Nowrap|{{pipe}}6{{pipe}} < 7}}</syntaxhighlight> or <syntaxhighlight lang="wikitext" inline>{{Nowrap|{{abs|6}} < 7}}</syntaxhighlight> Which renders this: :{{Nowrap||6| < 7}} == Technical details == The actual code that does the job is this HTML {{tag|span|open|link=yes}} tag that applies a class to the text inside the template: :{{code|lang=html|1=<span class="nowrap">This text will not wrap</span>}} The class <code>nowrap</code> receives the CSS property {{code|lang=css|white-space: nowrap;}} in [[MediaWiki:Common.css]]. == TemplateData == {{TemplateData header}} <templatedata>{ "description": "Prevents word wraps (line breaks) within text or inside a link which contains spaces or hyphens (-).", "params": { "1": { "label": "Text", "description": "Text or link to be protected.", "type": "string", "required": true } } }</templatedata> == See also == {{List of nowrap-like templates}} <includeonly>{{Sandbox other|| <!-- Categories go below this line, please; interwikis go to Wikidata, thank you! --> [[Category:Line-handling templates]] }}</includeonly>
Summary:
Please note that all contributions to 2swagg wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
2swagg wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Template
Discussion
Read
Edit source
History
Page actions
Template
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
janny
Noticeboard
Tools
What links here
Related changes
Special pages
Page information