Home  >  Article  >  Web Front-end  >  What is white-space in html

What is white-space in html

王林
王林Original
2021-02-24 11:41:117158browse

In HTML, the white-space attribute is used to specify how to handle the white space within the element, such as [white-space:normal], which means that the white space will be ignored by the browser. If you need to preserve white space, you can use [white-space:pre].

What is white-space in html

The operating environment of this article: windows10 system, html 5, thinkpad t480 computer.

Attribute introduction:

The white-space attribute specifies how to handle the white space within the element.

Attribute value:

  • normal Default. White space is ignored by the browser.

  • #pre Blank spaces will be retained by the browser. It behaves like the e03b848252eb9375d56be284e690e873 tag in HTML.

  • nowrap The text will not wrap. The text will continue on the same line until the 0c6dc11e160d3b678d68754cc175188a tag is encountered.

  • pre-wrap Preserves whitespace sequences, but wraps normally.

  • #pre-line Merges whitespace sequences, but retains newlines.

  • #inherit Specifies that the value of the white-space attribute should be inherited from the parent element.

Example:

p{
    white-space:nowrap;
}

Related recommendations: html tutorial

The above is the detailed content of What is white-space in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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