Properties
CSS
white-space
The white-space property specifies how white space inside the element is handled.
white-space: normal | pre | nowrap | pre-wrap | pre-line | inherit
| Initial: | normal |
| Applies To: | all elements |
| Inherited: | yes |
| Percentages: | NA |
| Media: | visual |
Values
white-space: value;
| Value: | Description: |
| inherit | Takes the same computed value as the property for the element's parent |
| normal | Collapses sequences of white space and breaks lines as necessary to fill line boxes |
| nowrap | Collapses sequences of white space, but suppresses line breaks within text |
| pre | Prevents collapsing sequences of white space and breaks lines at newlines in the source, or at occurrences of "\A" in generated content |
| pre-line | Collapses sequences of white space and breaks lines at newlines in the source, at occurrences of "\A" in generated content, and as necessary to fill line boxes |
| pre-wrap | Prevents collapsing sequences of white space and breaks lines at newlines in the source, at occurrences of "\A" in generated content, and as necessary to fill line boxes |
DOM
[window.]document.getElementById("element-id").style.whiteSpace = "white-space";
