CSS property - white-space White space property description
This CSS property is used to handle white space.
Values: normal | pre | nowrap | inherit
Available values Value description
normal Default value. Text wraps naturally. If it exceeds the width of the element, the content will naturally wrap to the next line.
nowrap does not allow line breaks.
pre preserves line breaks and whitespace. This value is only supported by IE 6 or above if you declare !DOCTYPE.
In HTML files, whitespace, such as line breaks, spaces, and tabs, are automatically truncated. HTML will automatically cut off extra spaces. No matter how many spaces you add, they are all counted as one space. To add spaces to a web page, you can use " to represent spaces. You can also use
to force line breaks.
Example code
.p1 {white-space: nowrap}
.p2 {white-space: normal}
Inheritance
is
applicable
All block elements.