freeCodeCamp/guide/english/css/properties/white-space-property/index.md

1.3 KiB

title
White Space Property

White Space Property

The white-space property sets how to display spaces between words.

Syntax

white-space: normal | nowrap | pre | pre-line | pre-wrap | inherit

Example

p {
  white-space: nowrap;
}

Values

Normal: Default value. Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. Nowrap: Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. Pre: Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the

 tag in HTML.
Pre-line:	Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary.
Pre-wrap:	Whitespace is preserved by the browser. Text will wrap when necessary.
Initial: Sets this property to its default value.
Inherit:	Inherits this property from its parent element.

Source:

White-space on W3schools

More Information:

White-space on MDN.