white-space | NN 4 IE n/a CSS 1 |
  | Inherited: Yes |
Sets how the browser should render whitespace (extra character spaces and carriage returns) that is part of the element's source code. Under normal circumstances, HTML ignores extra whitespace and thus collapses the rendered content around such space. For example, only single spaces are preserved between words and BR elements are required to force a line break within a paragraph. A whitespace attribute setting of pre treats whitespace as if you had surrounded the element in a PRE element. But although browsers have a tradition of rendering PRE elements in a monospace font, the look of an ordinary element set to white-space:pre preserves its font characteristics. | |
CSS Syntax white-space: whiteSpaceType | |
JavaScript Equivalent whiteSpace | |
Value One of three constants: normal | nowrap | pre. A value of normal allows regular HTML treatment of whitespace to rule. A value of nowrap (not available in Navigator 4) tells the browser to ignore line breaks in the source text (in case the author breaks up lines for readability in the editor) and break them on the page only where there are explicit HTML line breaks (with a BR element, for example). A value of pre has the browser honor all whitespace entered by the author in the source content, without adjusting any font settings of the element. | |
Initial Value normal | |
Example DIV.example {white-space: pre} | |
Applies To Block-level elements. |