Reputation: 1540
I'm doing a simple string replacement of space ("") with
to get some rudimentary formatting (multiple spaces in a row). However I finally discovered after all these years that
actually stands for non-breaking space, and I don't get any line wraps if I do a blanket replacement on my entire string.
Is there a special html character for a space that will break? The other replacement is to simply to my replacement search for double-spaces only.
Upvotes: 2
Views: 475
Reputation: 43481
You can use
followed by ​
to make breakpoints. It's zero-width space character that is used for making breakspaces inside words at specific points
div {
border: 1px solid #ddd;
width: 25px;
}
<div>a a</div>
<div>a ​ ​ ​ ​ ​ ​ ​a</div>
Upvotes: 5