white-space CSS property specifies how white-space such as spaces, tabs, and newline characters are handled inside the elements.
The following table summarizes the usages context and the version history of this property.
|Applies to:||All elements|
|Animatable:||No. See animatable properties.|
|Version:||CSS 1, 2, 3|
The syntax of the property is given with:
The example below shows the
white-space property in action.
ExampleTry this code »
The following table describes the values of this property.
||Sequences of whitespace will collapse into a single whitespace. Line breaks will occur wherever necessary to fill line boxes. This is default value.|
||Collapses whitespace as for normal, but suppresses line breaks within text.|
||Sequences of whitespace are preserved. Lines are only broken at preserved newline characters. Acts like the
||Sequences of whitespace will collapse into a single space character. Line breaks will occur at preserved newline characters, and wherever necessary to fill line boxes.|
||Sequences of whitespace are preserved. Line breaks will occur at preserved newline characters, and wherever necessary to fill line boxes.|
||Sets this property to its default value.|
||If specified, the associated element takes the computed value of its parent element
white-space property is supported in all major modern browsers.
pre-line is not supported in versions prior to Firefox 3.5, Safari 3.0 and Opera 9.5. The values
inherit are not supported in Internet Explorer 7 and earlier.
See tutorial on: HTML Text Formatting.