How to use css white-space attribute

青灯夜游
Release: 2019-05-27 14:09:07
Original
5520 people have browsed it

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 css white-space attribute

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 ;
Copy after login

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:

How to use css white-space attribute

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!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!