With Bootstrap 4 Class:
text-nowrap
Ref: https://getbootstrap.com/docs/4.0/utilities/text/#text-wrapping-and-overflow
If you only need to prevent line-breaks on space characters, you can use
entities between words:
No line break
instead of
<span style="white-space:nowrap">No line break</span>
white-space: nowrap
is the correct solution but it will prevent any break in a line. If you only want to prevent line breaks between two elements it gets a bit more complicated:
<p>
<span class="text">Some text</span>
<span class="icon"></span>
</p>
To prevent breaks between the spans but to allow breaks between "Some" and "text" can be done by:
p {
white-space: nowrap;
}
.text {
white-space: normal;
}
That's good enough for Firefox. In Chrome you additionally need to replace the whitespace between the spans with an
. (Removing the whitespace doesn't work.)
Source: Stackoverflow.com