Avoid to split two words in HTML or CSS

• 1 min read

Here the handy tip to avoid that two or more words are split in the paragraph.

Using the HTML only:

<p>
  These two&nbsp;words need to be in the same line
</p>

or with CSS:

<p>
  These <span class="together">two words</span> need to be in the same line
</p>
span.keeptogether {
  white-space: nowrap;
}