Specify that the text in the <div> element will never wrap:
The whiteSpace property sets or returns how to handle tabs, line breaks and whitespace in a text.
The whiteSpace property is supported in all major browsers.
Return the whiteSpace property:
Set the whiteSpace property:
Value | Description |
---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | normal |
---|---|
Return Value: | A String, representing how white-space inside an element is handled |
CSS Version | CSS1 |
Return the whiteSpace property
CSS tutorial: CSS Text
CSS reference: white-space property