white-space is a CSS property used to determine how white spaces and line breaks are handled and displayed in text.
There are different values for white-space, including:
normal: This is the default value. Continuous white spaces (including spaces and tabs) will be treated as a single space. Line breaks will occur when necessary to fit the text within the containing element's size.
nowrap: White spaces are not automatically wrapped. The text will not break into a new line, which may cause the text to overflow the container.
pre: Continuous white spaces and line breaks will be preserved in the text. Line breaks will create a new line.
pre-line: Continuous white spaces will be treated as a single space, while line breaks will create a new line.
pre-wrap: Continuous white spaces and line breaks will be preserved in the text. Line breaks will create a new line.
Usage
Example
HTML
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Molestiae cum sunt vel harum numquam explicabo deleniti vitae natus facilis, repellat autem ex, laboriosam doloribus officia, earum eum. Inventore, tempore harum.</p>
CSS
p {
white-space: nowrap;
}
Result:
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Molestiae cum sunt vel harum numquam explicabo deleniti vitae natus facilis, repellat autem ex, laboriosam doloribus officia, earum eum. Inventore, tempore harum.
Experience
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
Molestiae cum sunt vel harum numquam explicabo deleniti vitae natus facilis, repellat autem ex, laboriosam doloribus officia, earum eum. Inventore, tempore harum.