CSS:white-space
From MDC
[edit] Summary
The white-space CSS property is used to to describe how whitespace inside the element is handled.
- Initial value:
normal - Applies to: all elements
- Inherited: yes
- Percentages: n/a
- Media:
visual - Computed value: as specified
[edit] Syntax
white-space: normal | pre | nowrap | pre-wrap | -moz-pre-wrap | pre-line | inherit ;
[edit] Values
normal- all sequences of whitespace and line breaks will be collapsed. Line breaks are add to wrap the content.
pre- all white spaces in the source will be preserved, lines are only broken at newline characters in the source.
nowrap- all sequences of whitespace and line breaks will be collapsed, also line breaks (text wrapping) are suppressed within content.
pre-wrapNew in Firefox 3- all white spaces in the source will be preserved, lines are broken at newline characters and as needed to wrap the content.
-moz-pre-wrapDeprecated- Same as
pre-wrap, this is the Mozilla extension which became the CSS 2.1pre-wrap, which should be used instead. pre-line- all sequences of whitespace will be collapsed, lines are broken at newline characters and also as needed to wrap the content.
inherit- inherits from parent.
[edit] Examples
code {
white-space: pre;
}
[edit] Notes
Values pre-wrap and pre-line are not yet implemented in Mozilla. Currently you can use -moz-pre-wrap instead of pre-wrap.
[edit] Specifications
[edit] Browser compatibility
(Sample Compatibility Chart)
| Browser | Lowest Version |
|---|---|
| Internet Explorer | 0 |
| Firefox | 0 |
| Netscape | 0 |
| Opera | 0 |
| Safari | ? |
[edit] See also
text-indent, text-align, text-decoration, letter-spacing, word-spacing, text-transform, white-space, white-space-collapse, text-rendering, text-wrap, text-shadow