CSS white-space property

Examples

Provisions of paragraph text without line breaks:

p { white-space: nowrap ;}


Attribute definitions and instructions

white-space attribute specifies how to handle blank element inside.

Defaults: normal
inherit: yes
version: CSS1
JavaScript syntax: object .style.whiteSpace = "pre"


Browser Support

Figures in the table represent the first browser to support the version number of the property.

属性
white-space 1.0 5.5 3.5 3.0 9.5

Property Value

value description
normal default. Blank will be ignored by the browser.
pre Blank will be retained browser. Its behavior is similar to the HTML <pre> tag.
nowrap The text does not wrap text will continue on the same line until it encounters <br> tags so far.
pre-wrap Leave blank character sequence, but normally newline.
pre-line The combined whitespace sequences, but retain the line breaks.
inherit Provisions should inherit the white-space property value from the parent element.


related articles

CSS tutorial: CSS the Text