css The white-space attribute is used to set how to handle white spaces within elements. For example, if white-space: nowrap is set, all line breaks and spaces at the beginning and end of the line will be merged, the text will not wrap, and the text will continue on the same line. Until the
tag is encountered.

How to use the css white-space attribute?
The white-space attribute sets how to handle whitespace within an element.
This attribute declares how to handle whitespace characters in elements during the layout process.
Syntax:
white-space : normal | pre | nowrap | pre-wrap | pre-line ;
Attribute value:
normal: Default. White space is ignored by the browser.
pre: Blank spaces will be retained by the browser. It behaves like the
tag in HTML.nowrap: The text will not wrap. The text will continue on the same line until the
tag is encountered.pre-wrap: Preserve whitespace sequences, but wrap lines normally.
pre-line: Combine whitespace sequences but retain newlines.
Note: The values pre-wrap and pre-line are new in CSS 2.1.
Note: Any version of Internet Explorer (including IE8) does not support the attribute value "inherit".
css white-space property Example
php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网
php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网 php中文网
Copy after login
Output:

The above is the detailed content of How to use css white-space attribute. For more information, please follow other related articles on the PHP Chinese website!