NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix b » css1 / css2 properties

white-space


This property controls how spaces, tabs, and newline characters are handled in an element. Possible values are normal, pre, and nowrap. The normal value collapses multiple white space characters into single spaces and automatically wraps lines, as in normal HTML/XHTML. The pre value makes the element act much like a <pre> tag and preserves all white space. The value of nowrap prevents lines from wrapping if they exceed the element's content width.

Examples


p {white-space: pre;}
pre {white-space: normal;}
.sourcecode {white-space: nowrap;}

Browser and CSS Support Notes


CSS1
IE 5.5, 6
Nav 4, 4.5-4.8 (partial), 6, 7
Opera 4, 5, 6, 7

(X)HTML Elements
CSS Properties
Back: visibility Next: widows
< Home | About | Chapters | Examples | Errata | Reference | Site Map >