Style whiteSpace Property
Style whiteSpace Property
The whiteSpace property is used to either set or return how to handle line breaks, whitespaces, and tabs in a text.
Syntax:-
Its syntax is:- object.style.whiteSpace OR object.style.whiteSpace = normal | nowrap | pre | initial | inherit
Return:-
Its return is:- string explaining how white spaces inside an element are handled
Further Explanation:-
Value | Description |
---|---|
normal | Sequences of whitespace will collapse into a single whitespace and text will wrap when necessary. |
nowrap | Sequences of whitespace will collapse into a single whitespace but text will never wrap to the next line until a br tag is encountered. |
pre | Whitespace is preserved by the browser and text will only wrap on line breaks. |
pre-line | Sequences of whitespace will collapse into a single whitespace and text will wrap when necessary and on line breaks. |
pre-wrap | Whitespace is preserved by the browser and text will wrap when necessary and on line breaks |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |