Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS white-space property


May 06, 2021 CSS Reference Manual


Table of contents


CSS white-space property

Description of property definition and use

The white-space property specifies how white space is handled within an element.

Default: normal
Inherited: yes
Version: CSS1
JavaScript syntax: object .style.whiteSpace="pre"

The property value

Value Describe
normal Default. Blanks are ignored by the browser.
pre The white space is retained by the browser. It behaves like a label in HTML.
nowrap The text does not line, and the text continues on the same line until the label is encountered.
pre-wrap The blank character sequence is preserved, but the line breaks normally.
pre-line Merges the blank character sequence, but retains the line break.
inherit Specifies that the value of the white-space property should be inherited from the parent element.

Browser support

The numbers in the table support the first browser version number of the property.

Attributes
white-space 1.0 8.0 3.5 3.0 9.5

Specify that the text in the paragraph does not line up:

p
{
white-space:nowrap;
}

Try it out . . .

Related articles

CSS tutorial: CSS Text