11 Vote

HTML: Prevent line break between two words

Question by Guest | 2018-02-01 at 19:06

I have a text in which some words belong together and for this reason should not be separated or wrapped by a line break in the next line.

The words should either stay together in the first line or jump together to the next line when there is a line break necessary and not enough space available. Is there any statement or code in HTML for that?

1Best Answer3 Votes

You can use the so-called non breaking space for those cases. Just write the character   (non-breaking space) between the words that should not be separated:

The number 123 456 will stay together.

In this example, "123" and "456" will not be separated and will always stay together.

You can find more HTML ways for preventing line breaks in my article "No line break between specific words" or in the article about preventing line breaks with CSS.
2018-02-01 at 19:50

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.