/

HTML / CSS / JavaScript Tutorial

CSS Property: white-space

[this page | pdf | back links]

The CSS (CSS1) white-space property indicates how white-space inside an element should be handled.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

normal

(default value). Sequences of whitespace collapsed into a single whitespace and text will wrap when necessary

nowrap

Sequences of whitespace collapsed into a single whitespace but text will not wrap until a <br> tag occurs

pre

Whitespace is preserved by browser and text will only wrap on line breaks (i.e. akin to <pre> tag in HTML)

pre-line

Sequences of whitespace collapsed into a single whitespace and text will wrap when necessary and on line breaks

pre-wrap

Whitespace is preserved by browser and text will wrap when necessary and on line breaks

 

Default Value:

normal

JavaScript syntax:

e.g. object.style.whiteSpace="hidden"

Inherited:

Yes

Animatable:

No

 


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile