HOME

TheInfoList



OR:

In
word processing A word processor (WP) is a device or computer program that provides for input, editing, formatting, and output of text, often with some additional features. Word processor (electronic device), Early word processors were stand-alone devices dedicate ...
and
digital typesetting Typesetting is the composition of text for publication, display, or distribution by means of arranging physical ''type'' (or ''sort'') in mechanical systems or ''glyphs'' in digital systems representing '' characters'' (letters and other ...
, a non-breaking space (), also called NBSP, required space, hard space, or fixed space (in most
typeface A typeface (or font family) is a design of Letter (alphabet), letters, Numerical digit, numbers and other symbols, to be used in printing or for electronic display. Most typefaces include variations in size (e.g., 24 point), weight (e.g., light, ...
s, it is not of fixed width), is a
space character A whitespace character is a character data element that represents white space when text is rendered for display by a computer. For example, a ''space'' character (, ASCII 32) represents blank space such as a word divider in a Western scri ...
that prevents an automatic line break at its position. In some formats, including
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
, it also prevents consecutive
whitespace character A whitespace character is a character data element that represents white space when text is rendered for display by a computer. For example, a ''space'' character (, ASCII 32) represents blank space such as a word divider in a Western scrip ...
s from collapsing into a single space. Non-breaking space characters with other widths also exist.


Uses

Despite having layout and uses similar to those of
whitespace White space or whitespace may refer to: Technology * Whitespace characters, characters in computing that represent horizontal or vertical space * White spaces (radio), allocated but locally unused radio frequencies * TV White Space Database, a m ...
, it differs in contextual behavior.


Non-breaking behavior

Text-processing software typically assumes that an automatic line break may be inserted anywhere a space character occurs; a non-breaking space prevents this from happening (provided the software recognizes the character). For example, if the text "100 km" will not quite fit at the end of a line, the software may break the line between "100" and "km". Using a non-breaking space between "100" and "km" will prevent this behaviour. This guarantees that the text "100 km" will not be broken—if it does not fit at the end of a line, it is moved in its entirety to the next line. For this reason, many style guides recommend using a non-breaking space between numbers and their associated units. In
French French may refer to: * Something of, from, or related to France ** French language, which originated in France ** French people, a nation and ethnic group ** French cuisine, cooking traditions and practices Arts and media * The French (band), ...
typography, non-breaking spaces are used before "high punctuation" (:, ;, ?, and !), on the interior side of
guillemet Guillemets (, also , , ) are a pair of punctuation marks in the form of sideways double chevrons, and , used as quotation marks in some languages. In some of these languages, "single" guillemets, and , are used for a quotation inside another ...
s (« and »), and before
footnote In publishing, a note is a brief text in which the author comments on the subject and themes of the book and names supporting citations. In the editorial production of books and documents, typographically, a note is usually several lines of tex ...
s. In the case of ;, ?, !, and footnotes (unless enclosed by parentheses), it is specifically the
narrow non-breaking space In word processing and digital typesetting, a non-breaking space (), also called NBSP, required space, hard space, or fixed space ( ...
that is used. In
German German(s) may refer to: * Germany, the country of the Germans and German things **Germania (Roman era) * Germans, citizens of Germany, people of German ancestry, or native speakers of the German language ** For citizenship in Germany, see also Ge ...
typography, it is used between multi-part abbreviations (e.g., "''z.B.''", "''d.h.''", "''v.l.n.r.''").


Non-collapsing behavior

A second common application of non-breaking spaces is in
plain text In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a lim ...
file formats such as
SGML The Standard Generalized Markup Language (SGML; International Organization for Standardization, ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on t ...
,
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
,
TeX Tex, TeX, TEX, may refer to: People and fictional characters * Tex (nickname), a list of people and fictional characters with the nickname * Tex Earnhardt (1930–2020), U.S. businessman * Joe Tex (1933–1982), stage name of American soul singer ...
and
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well. In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
, whose rendering engines are programmed to treat sequences of
whitespace characters A whitespace character is a character (computing), character data element that represents White space (visual arts), white space when text string, text is Rendering (computer graphics), rendered for display by a computer. For example, a ''Space ...
(space, newline, tab,
form feed A page break is a marker in an electronic document that tells the document interpreter the content which follows is part of a new page. A page break causes a form feed to be sent to the printer during spooling of the document to the printer. It i ...
, etc.) as if they were a single character (but this behavior can be overridden). Such "collapsing" of whitespace allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final
typeset Typesetting is the composition of text for publication, display, or distribution by means of arranging physical ''type'' (or ''sort'') in mechanical systems or ''glyphs'' in digital systems representing '' characters'' (letters and other ...
result. In contrast, non-breaking spaces are not merged with neighboring whitespace characters when displayed. They can, therefore, be used by an author to simply insert additional visible space in the resulting output without using spans styled with peculiar values of the CSS "white-space" property. Conversely, indiscriminate use (see the recommended use in
style guide A style guide is a set of standards for the writing, formatting, and design of documents. A book-length style guide is often called a style manual or a manual of style. A short style guide, typically ranging from several to several dozen page ...
s), in addition to a normal space, gives extraneous space in the output.


Variations


Narrow non-breaking space

is another non-breaking space, but with a smaller width than the standard non-breaking space (U+00A0). When used with
Mongolian Mongolian may refer to: * Something of, from, or related to Mongolia, a country in Asia * Mongolian people, or Mongols * Bogd Khanate of Mongolia, the government of Mongolia, 1911–1919 and 1921–1924 * Mongolian language * Mongolian alphabet * ...
, its width is usually one third of the normal space; in other contexts, its width is about 70% of the normal space, but may resemble that of the
thin space In typography, a thin space is a space character whose width is usually or of an em. It is used to add a narrow space, such as between nested quotation marks or to separate glyphs that interfere with one another. It is not as narrow as the hai ...
(U+2009), at least with some fonts. It was introduced in Unicode 3.0 for Mongolian, to separate a suffix from the word stem without indicating a word boundary. It also triggers special shaping of those suffixes. Starting in Unicode 16.0, it is no longer recommended for this purpose, with the Mongolian vowel separator (U+180E) being recommended for this purpose instead. In
French French may refer to: * Something of, from, or related to France ** French language, which originated in France ** French people, a nation and ethnic group ** French cuisine, cooking traditions and practices Arts and media * The French (band), ...
typography, it is called and is used before ;, ?, and !. Additionally, footnotes are preceded by a narrow non-breaking space (unless they are enclosed by parentheses, in which case a regular non-breaking space is used). The narrow non-breaking space is used in numbers as a
group separator The C0 and C1 control code or control character sets define control codes for use in text by computer systems that use ASCII and derivatives of ASCII. The codes represent additional information about the text, such as the position of a cursor, a ...
in French (starting in Unicode CLDR 34) and
Venetian Venetian often means from or related to: * Venice, a city in Italy * Veneto, a region of Italy * Republic of Venice (697–1797), a historical nation in that area Venetians might refer to: * Masters of Venetian painting in 15th-16th centuries * ...
(starting in Unicode CLDR 44). In Spanish, the
Royal Spanish Academy The Royal Spanish Academy (, ; ) is Spain's official royal institution with a mission to ensure the stability of the Spanish language. It is based in Madrid, Spain, and is affiliated with national language academies in 22 other Hispanophon ...
and
Association of Academies of the Spanish Language The Association of Academies of the Spanish Language (; ASALE) is an entity whose end is to work for the unity, integrity, and growth of the Spanish language. It was created in Mexico in 1951 and represents the union of all the separate academies ...
's ''
Diccionario panhispánico de dudas The ''Diccionario Panhispánico de dudas'' (''DPD''; English: ''Pan-Hispanic Dictionary of Doubts'') is an elaborate work undertaken by the Royal Spanish Academy and the Association of Academies of the Spanish Language with the goal of resolving qu ...
'' prescribes the use of a small space as the number group separator, although this is not the case in Unicode's
Common Locale Data Repository The Common Locale Data Repository (CLDR) is a project of the Unicode Consortium to provide locale data in XML format for use in computer applications. CLDR contains locale-specific information that an operating system will typically provide to ...
(CLDR).


Other variations

Other non-breaking variants defined in Unicode. ; :Produces a space equal to the figure (0–9) characters. ; :Encoded in Unicode since version 3.2. The word joiner does not produce any space and prohibits a line break at its position.


Example

On browsers, resizing the window will demonstrate the effect of non-breaking spaces on the texts below. To show the non-breaking effect of the non-breaking space, the following words have been separated with non-breaking spaces:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinimVeniamQuisNostrudExercitationUllamcoLaborisNisiUtAliquipExEaCommodoConsequatDuisAute
To show the non-collapsing behavior of the non-breaking space, the following words have been separated with an increasing number of non-breaking spaces:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinim
In contrast, the following words are separated with ordinary spaces:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Here, they are separated with narrow non-breaking spaces, to show the width of those:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinimVeniamQuisNostrudExercitationUllamcoLaborisNisiUtAliquipExEaCommodoConsequatDuisAute


Unicode

* * * *


See also

* Hyphens in computing, for information about hard and non-breaking hyphens *
List of XML and HTML character entity references In SGML, HTML and XML documents, the logical constructs known as ''character data'' and ''attribute values'' consist of sequences of characters, in which each character can manifest directly (representing itself), or can be represented by a series ...
* * * * ** , for applications ** , a non-spacing break * * *


Notes


References

{{DEFAULTSORT:Non-breaking space Control characters Whitespace Unicode formatting code points