Template:Nowrap is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use ((edit protected)) to notify an administrator to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
Text and/or other creative content from this version of Template:Nowrap was copied or moved into incubator:Template:Wp/nod/nowrap with this edit. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
This template is a replacement for the unsupported nonstandard <nobr> tag. cesarb 19:50, 20 Mar 2005 (UTC)
It is also even stronger than using non-breaking spaces ("
"s) between words, viz. it will ignore (right-hand) margins, borders, etc. David Kernow (talk) 06:45, 26 November 2006 (UTC)
Hi everyone. I got tired of handling word wrapping in long link lists, for instance in navigation boxes. So I have made a new template similar to ((nowrap))
, but that only prevents word wraps in links. That is, it allows wraps between links and in normal text. Thus one single ((nowraplinks)) tag can surround the whole link list instead of having one ((nowrap))
tag around each link or using lots of
.
I would like if some expert template editors (preferably with some CSS experience) take a loot at it to see that I didn't miss anything. I think this template might be used a lot once we deploy it.
Oh, I probably should mention that this template will need the addition of one line of CSS code to common.css. So I think this needs to be thoroughly checked and discussed before we deploy it. (And I am not an admin so I can not add that line of code myself.)
--David Göthberg 04:59, 10 August 2007 (UTC)
((editprotected))
I suggest the code between the noinclude tags be changed. (Mostly to make the page look better really.) The changes I suggest is using the new small padlock, the new ((template doc)) and the category comment, as recommended in Wikipedia:Template documentation. Here is how the full page code looks with my suggested changes:
<includeonly><span style="white-space:nowrap">(({1))}</span></includeonly><noinclude> ((pp-template|small=yes)) ((template doc)) <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
--David Göthberg 14:31, 23 August 2007 (UTC)
((editprotected)) 17-Dec-2007: The coding currently uses "<includeonly>" which I don't think is needed in a highly size-critical template: the includeonly-tag adds 27 characters, and when the includeonly-tag is omitted, the result just shows "(({1))}" above the documentation, which is harmless and emphasizes that parameter-1 is required. Also, I recommend using a shorter comment, to reduce Template:Nowrap by 21%, from 185 bytes to 146 bytes:
<span style="white-space:nowrap">(({1))}</span><noinclude> ((documentation))<!--put categories & interwikis in /doc subpage, only!--> </noinclude>
I am concerned about the template size, in conjunction with other templates used on a page, because I've hit template-buffer limits when repeated sub-templates contained only 500 characters. However, I really recommend using " " instead of a template, because " " (used once per wikilink) adds only 6 characters, not 185, and not even 146 characters to each non-wrapped wikilink. Remember, the MediaWiki language version 1.6 treats pages as template-expansion buffers, repeating all template contents as inline text. -Wikid77 (talk) 11:14, 17 December 2007 (UTC)
((editprotected))
From the description of the template's action we have a certain expectation.
x((nowrap| TEXT ))y
should yield
x<span style="white-space:nowrap"> TEXT </span>y
But in fact it yields
x <span style="white-space:nowrap">TEXT</span> y
I therefore request that the documentation be changed; or, preferably, that the coding of the template be fixed so that it behaves as specified. As things stand, breaks occur in unpredicted ways.
Alternatively, see the better but more radical alteration suggested below.
, at the start or the end of the enclosed string?Even if the behaviour of the template is altered as suggested above, there is a difficulty with the way browsers treat this code:
x<span style="white-space:nowrap"> TEXT </span>y
In recent versions of Firefox and IE at least, this code allows breaks to occur between x and TEXT, and between TEXT and y. Since this behaviour is itself unruly, I request that the coding of the template be altered so that a
is substituted for each ordinary space in the enclosed text. This would ensure the desired result. It has the added advantage that multiple ordinary spaces would yield multiple instances of
. Whether or not these are deprecated, they are sometimes convenient and sometimes intended.
These concerns arose out of investigations regarding markup for the hard space. See our draft proposal, which I have just amended in light of the anomalies raised above:
See a full draft of the proposal |
---|
|
There is active discussion of the proposal at WT:MOS. Template editors will be very welcome there.
– Noetica♬♩ Talk 23:53, 22 January 2008 (UTC)
The behaviour signaled above is part of a larger pattern. Also a'' x ''b
leads to HTML a <i>x</i> b, with the spaces pulled out of the italic tags. −Woodstone (talk) 10:50, 23 January 2008 (UTC)
Even coding
x<span style="white-space:nowrap"> TEXT </span>y
still results in a possible break before TEXT in IE (though not after it). Mysterious! −Woodstone (talk) 23:08, 23 January 2008 (UTC)
 
is substituted for
.) Firefox handles the code correctly. But you'll love this:
x <span style="white-space:nowrap">TEXT</span> y z
As a webmaster and Wikipedia editor I have worked a lot with line breaking issues. In the end I created ((nowraplinks)) and ((nowrap begin)) and their helper templates to solve/handle the problems with ((nowrap)). I took a look at the suggestion above to use the wikimarkup 34,,kg
to mean 34 kg
and it seems to me it is a good suggestion.
Of course what really is needed is that the World Wide Web Consortium (W3C) finally accept and standardise the old well working and easy to use HTML markup <nobr> +
.
--David Göthberg (talk) 09:40, 26 February 2008 (UTC)
Much said about the defiencies of the template and how
does the job better but if its a non-breaking hyphen, en dash, degree sign, etc. you want, this is your template. Jɪmp 22:09, 25 January 2008 (UTC)
((nobreak|aaaaaa—))bbbbbbb
. The intention is to keep the em-dash attached to the left part and allow a break after it. Strangely enough IE does not allow the break after the em-dash. Actually a straight aaaaaa—bbbbbbb
has the desired effect in IE. I did not delve deeper, but behaviour seems to be very erratic. −Woodstone (talk) 23:29, 25 January 2008 (UTC)((nowrap|aaaaaa–))bbbbbbb
[en dash]((nowrap|aaaaaa…))bbbbbbb
[preformed ellipsis]aaaaaa–​bbbbbbb
,^,
, leading to
aaaaaa–,^,bbbbbbb
aaa-bbb
, 20–30 °C
allow breaks which may be undesireable. Jɪmp 07:04, 27 January 2008 (UTC),^,
should be deployed since it will only work in some browsers. But at-least it did wrap properly in all my browsers. (I have not tested with Safari since Safari is not available for my OS.)((nowrap))
does what it is supposed to do, it prevents line wraps in the text that it surrounds.I first rough version of Wikipedia:Line break handling is done. Its a how-to guide about how to handle word wraps (line breaks) at Wikipedia. Take a look and discuss it on its talk page.
--David Göthberg (talk) 21:40, 11 March 2008 (UTC)
Hi, this template doesn't seem to be working here: Nitrogen dioxide#Monomer-dimer equilibrium. It simply shows up as (({1))}. Not sure why the template parameter isn't being substituted; can anybody help?—Tetracube (talk) 19:10, 19 October 2009 (UTC)
Hello, ist there a reason to have a space after the j in the dokumentation?
We saw ((j |1 [[black rhino]])) but ((j|800 [[zebra]]s)). <br>May render like this: :We saw ((j |1 [[black rhino]])) but<br>800 [[zebra]]s. <br>Or like this: :We saw ((j |1 [[black rhino]]))<br>but 800 [[zebra]]s. <br>But ''not'' render like this: :We saw 1 [[black rhino|black<br>rhino]] but 800 [[zebra]]s.
--Diwas (talk) 21:07, 25 September 2011 (UTC)
Hello, to fix texts like “6 ft 6in (1.98m) and 17st 9 lbs (112 kg)” to a correct text and simple source text, I extended this template to up to five texts, see Template:Nowrap5. What you are thinking about it. The first use --Diwas (talk) 00:14, 25 November 2011 (UTC)
I see that the following were removed from Template:Nowrap/doc#See also with the edit note "removed links to obsolete methods":
Are these really obsolete? The latter is recommended in Wikipedia:Line break handling. Both seem likely to be useful. — Quondumtc 06:03, 7 January 2012 (UTC)
Brackets within the Nowrap template, it has been suggested, might be a problem which can be solved by escaping or representing with the HTML character entities & # 91; (minus spaces) for the opening bracket and & # 93; (minus spaces) for the closing bracket. Is that so and, if it is so, should we add it to the template documentation? Nick Levinson (talk) 16:19, 7 August 2012 (UTC) (Corrected my link error: 16:24, 7 August 2012 (UTC))
This edit request to Template:J has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
A protected redirect, Template:J, needs an incorrect redirect category (rcat) template removed and the correct rcat added. Please modify it as follows:
#REDIRECT [[Template:Nowrap]] ((R from template shortcut))
#REDIRECT [[Template:Nowrap]] ((Redr|from template shortcut))
Template Redr is an alias for the ((This is a redirect)) template, which is used to sort redirects into one or more categories. No protection rcat is needed, and if ((pp-protected)) and/or ((pp-move)) suffice, the This is a redirect template will detect protection level(s) and include them automatically. Thank you in advance! – Paine EllsworthCLIMAX! 19:35, 1 February 2015 (UTC)
-- [[User:Edokter]] ((talk))
20:32, 1 February 2015 (UTC)
Is there a version of this template that will permit wraps but limit it to a certain number? Like if you want to limit a string of text to being wrapped into only two lines, when window resizing might otherwise force it into three or more lines, and it isn't feasible to manually insert a line break or to use <wbr>
. postdlf (talk) 16:55, 4 April 2015 (UTC)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
This template needs an update to commented text near the bottom. Please modify it as follows:
<span class="nowrap">(({1))}</span><noinclude> ((documentation)) <!--interwikis/categories go inside doc--> </noinclude>
<span class="nowrap">(({1))}</span><noinclude> ((documentation)) <!-- Categories go on the /doc page; interwikis go to Wikidata. --> </noinclude>
Thank you in advance! Paine 18:15, 27 November 2015 (UTC)
-- [[User:Edokter]] ((talk))
10:16, 28 November 2015 (UTC)
-- [[User:Edokter]] ((talk))
16:22, 28 November 2015 (UTC)To editors Edokter and Redrose64: – thank you both very much for your concerns and my edification in this matter! Happy holidays! Paine 19:43, 28 November 2015 (UTC)
Not sure what needs tweaking but, on several occasions, ((nowrap)) used around an open parenthesis and the subsequent text has been leaving the parenthesis on the first line and only keeping the following text together. Obviously, the parenthesis needs to move with the rest of the text. — LlywelynII 06:20, 19 May 2016 (UTC)
-- [[User:Edokter]] ((talk))
07:04, 19 May 2016 (UTC)Compare use of ((nowrap)):
and use of <span style="white-space:nowrap">
:
on both desktop and mobile. Both work on desktop; the former fails to suppress a line break before the subscript/superscript stack on mobile. Hairy Dude (talk) 23:12, 15 July 2017 (UTC)
<span style="white-space:nowrap">...</span>
instead of ((nowrap))
, the problem cannot lie in that template and so this talk page is not an appropriate place to report a problem that lies elsewhere.<span>...</span>
which has the style declaration display:inline-block;
, and I'm pretty sure that white-space:nowrap
only works on purely inline text, the problem is in ((su))
for which the code is at Module:Su. --Redrose64 🌹 (talk) 09:48, 16 July 2017 (UTC)
<span style="white-space:nowrap">...</span>
, not vice versa. Besides, it reproduces in the absence of ((su)). From Pains and Penalties Bill 1820:In the very first paragraph of Natural logarithm one finds loge x within the nowrap template, and one sees (if one's window geometry is so adjusted) this:
Obviously that should not happen. Michael Hardy (talk) 17:36, 4 August 2017 (UTC)
word-wrap
property provided by the content
class and set to break-word
, and no value for white-space
(the computed value is normal
). Hairy Dude (talk) 15:23, 12 September 2017 (UTC)This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
I'd like to request that ((lowercase title)) be added to the template page under <noinclude> tags. There is easy confusion over the intended formatting of the template title, which is, according to the documentation, intended to be ((nowrap)) instead of ((Nowrap)). I had initially confused this as well, myself, simply looking at the title of the template with the first letter capitalised. I had to have a fellow editor (@GAV80:) tell me that this is not the actual title of the template. Confusion can easily be prevented by adding a ((lowercase title)) to force a lowercase first letter in the template's name. – PhilipTerryGraham (talk · contribs · ) 18:11, 11 November 2017 (UTC)
((nowrap))
or ((Nowrap))
. --Redrose64 🌹 (talk) 21:36, 11 November 2017 (UTC)
We have a ((nowrap)) template, but can we also have a ((wordbreak)) template? (Or ((word-break)).)
This (note the bold part):
<div style="width:150px; border:1px solid #000000; padding:7px; word-break:normal;">This div contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will not break or wrap to the next line.</div>
Results in:
This (again, note the emphasis):
<div style="width:150px; border:1px solid #000000; padding:7px; word-break:break-all;">This div contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</div>
Results in:
A wordbreak template could help make fixing things like this easier. It's a screenshot made with my Samsung Galaxy S7 when viewing the intro of MDMA. You can also fix it by adding a span tag around it (screenshot of the result) but a template similar to nowrap would be more convenient.
Any thoughts? Cheers, Manifestation (talk) 11:33, 17 July 2018 (UTC)
word-wrap:break-word;
with word-break:break-all;
. I incorrectly believed they both had the same effect. The former, however, will always break the word at the hyphen if there is one, even if the hyphen is not at the edge of the element. The latter will always and only break the word at the edge of the element, regardless if there is a hyphen somewhere earlier in the word. So I believe word-break to be superior. Also changed my previous edit at MDMA. - Manifestation (talk) 16:52, 17 July 2018 (UTC)
<wbr />
tag, which is used to indicate word breaking opportunities - that is, places where a broken word would be acceptable: word-break:break-all
.
<wbr />
is that it isn't placed randomly, and since all chemical compound names are made up of shorter components, we would put the tag between two of those components: Isothio<wbr />cyanato<wbr />benzoyl<wbr />ecgonine
. --Redrose64 🌹 (talk) 11:47, 21 July 2018 (UTC)Is there a template that has the same function as this one but uses <div>...</div>
tags instead of <span>...</span>
tags? I ask because editors sometimes use ((nowrap)) around list templates like ((hlist)) and its siblings, which causes a Linter error, since div tags are not allowed to be wrapped by span tags. – Jonesey95 (talk) 17:58, 4 December 2018 (UTC)
|class=nowrap
or |style=white-space:nowrap
to the ((hlist)), but that will nowrap the entire thing. if you just want to nowrap the list items, |item_style=white-space:nowrap
should work. it would be good to have |item_class=nowrap
, but I don't think that is supported. Frietjes (talk) 21:19, 4 December 2018 (UTC)
<div class="nowrap">(content, including hlist or similar template)</div>
(example edit), but a template that does the same thing would be more elegant and probably less prone to error. – Jonesey95 (talk) 21:58, 4 December 2018 (UTC)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
The current wikicode seems to be producing a linter error. The solution, according to mw:Help:Extension:Linter/pwrap-bug-workaround is to add a newline above the initial <span> tag. Wugapodes [thɑk] [ˈkan.ˌʧɹɪbz] 01:50, 4 May 2019 (UTC)
<div>...</div>
element, and using it in other ways that are incompatible with the wikicode contained in the template, will cause Linter errors. If you provide examples, we can usually recommend a better way to resolve the issue. There are currently no pages listed at Special:LintErrors/pwrap-bug-workaround. – Jonesey95 (talk) 21:31, 5 May 2019 (UTC)
What is this template for? It creates a fixed width element inside of something that needs to be at the very least editable with break tags to limit width. When images or other graphical elements are too wide, the body text is pinched and unreadable. -ApexUnderground (talk) 19:53, 26 June 2019 (UTC)
((nowrap))
is only intended for use in those? --Redrose64 🌹 (talk) 20:29, 26 June 2019 (UTC)
I just want to put some nbsp in a div and nowrap is added automatically. This makes the template expansions too big. 217.162.112.133 (talk) 03:52, 24 September 2019 (UTC)
See Wikipedia:Templates for discussion/Log/2020 April 26 for a proposal to merge ((Wrap)) and ((Allow wrap)), which appear to be essentially the same. – Jonesey95 (talk) 04:26, 27 April 2020 (UTC)
This documentation says to use this template sparingly, but offers no definition of 'sparingly", and no suggestions to regulate usage. What dose it really mean? When should or should not this template be used? -- Mikeblas (talk) 21:33, 21 October 2020 (UTC)
((nowrap|a great nuisance))
would be excessive use of the template. --RichardW57 (talk) 02:27, 22 October 2020 (UTC)I can only speak for Chrome on Android:
((nowrap)) works as described in WP:NOWRAP, but not inside infoboxes, where it's ignored entirely, while and ((US$|anything here)) prevent wrapping fine. Why? 70.163.208.142 (talk) 09:53, 23 August 2022 (UTC)