The white-space property specifies how white space is handled within an element.

  • Initial valuenormal
  • Applies toAll elements
  • InheritedYes
  • MediaVisual
  • Computed valueAs specified
  • AnimatableNo
  • CSS VersionCSS1, CSS2, CSS3
  • JavaScript
Formal syntax: normal | pre | nowrap | pre-wrap | pre-line

white-space: normal;
white-space: pre;
white-space: nowrap;
white-space: pre-wrap;
white-space: pre-line;
  • normalSequences of whitespace are collapsed. Newline characters in the source are handled as other whitespace. Breaks lines as necessary to fill line boxes.
  • preLine breaks and other whitespace are preserved.
  • nowrapLike normal, this value collapses white space; but like pre, it does not allow wrapping.
  • pre-lineLike normal, this value collapses consecutive spaces and allows wrapping, but preserves segment breaks in the source as forced line breaks.
  • pre-wrapLike pre, this value preserves white space; but like normal, it allows wrapping.
  • inherit
.class {
   white-space: pre-wrap;

Last updated on 23rd March 2014 By Rene Spronk

View All CSS Properties

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.