Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the opposite of a nbsp?

A   character is a space which doesn't allow for line breaking.

<p>lorem ipsum here&nbsp;are&nbsp;some&nbsp;words and so on</p>  | lorem ipsum                | | here are some words and so | | on                         | 

What's the opposite of that? That is, a character which is NOT rendered as a space, but CAN be used for line breaking.

<p>foo supercalifragilisticexpialidocious bar</p> <!--   put char here ^   and here ^ -->  |foo supercalifragi | |listicexpiali      | |docious bar        |  or with wider size:  |foo supercalifragilisticexpiali   | |docious bar                       | 

I'm aware of the soft-hyphen character, but for my purposes, I specifically do not want a hyphen added at the break.

like image 802
nickf Avatar asked Jan 12 '10 03:01

nickf


People also ask

What can I use instead of &nbsp in HTML?

In CSS property padding and margin can be used to tab space instead of non-breaking spaces (nbsp).

What is non-breaking space character?

Non-breaking spaces, also known as no-break, non-breakable, hard or fixed spaces, are characters that look exactly like regular spaces. You cannot see the difference between a non-breaking space and a regular space either on the page or on most screens.

What is a nonbreaking space in HTML?

A non-breaking space prevents line breaks from occurring at a particular point in an HTML document. To use a non-breaking space, you would use the following: &nbsp; For example, if you wanted the words "Mr."

What is the code for a nonbreaking space?

Alternatively called a fixed space or hard space, NBSP (non-breaking space) is used in programming and word processing to create a space in a line that cannot be broken by word wrap. With HTML, &nbsp; lets you create multiple spaces that are visible on a web page and not only in the source code.


2 Answers

You want the unicode character ZERO-WIDTH SPACE (\u200B).

You can get it in HTML with &#8203; or &#x200b;.

Explicit breaks and non-breaks:

LB7 : Do not break before spaces or zero width space.
LB8 : Break before any character following a zero-width space, even if one or more spaces intervene.
http://unicode.org/reports/tr14/

like image 146
Anon. Avatar answered Oct 13 '22 04:10

Anon.


There also is the little-known wbr tag, which lets the browser to decide whether to break the line or not.

like image 43
Matt Hampel Avatar answered Oct 13 '22 06:10

Matt Hampel