本文档基于 CC协议(Creative Commons Share-Alike License)发布,是developer.mozilla.com, www.mozref.comwww.aptana.com共同劳动的成果。

white-space

Specifies how to handle white space characters for the element.

Browser/User Agent Support

IENetscapeMozillaOperaSafari
5.5+4.0+1.0+9.0+1.0+
  • IE: IE only supports the "pre" value for white-space.
  • Mozilla: Support for white-space is incomplete.
  • Opera: Opera almost has full support for the white-space attribute.
  • Safari: Support for white-space is incomplete.

Values

normalCollapse whitespace normally.
preDo not collapse whitespace.
nowrapCollapse whitespace unless specified otherwise by an appropriate tag (e.g. br).
pre-wrapPrevents user agents from collapsing sequences of whitespace.
pre-lineUser agents should collapse sequences of whitespace.

Example

For a demonstration of the white-space attribute for table columns, see the demo page on quirksmode:

http://www.quirksmode.org/css/whitespace.html

Availability

W3C CSS2

Related