Experienced HTML designers will be accustomed to the fact that whitespace in HTML source code (sequences spaces, tabs, and line breaks) is collapsed to a single space character in the rendered output, and that line breaks occur only due to normal word wrapping performed by the browser or due to a hard break (<br/>) tag. Non-breaking space characters ( ), the nowrap attribute in table tags, and the HTML <pre> tag can be used to work around this behavior, when necessary.
The white-space property lets you assign the special properties of these work-arounds to other document elements so that the document code need not reflect the intended formatting.
Inherited: Yes
This property will accept any one of the following constant values:
normal: Content is rendered with the default HTML behavior. Whitespace is collapsed and word wrapping is performed.
nowrap: Whitespace is collapsed as with normal, but word wrapping does not occur. Line breaks will occur only when specified with <br/> tags or when present in generated content (see Section B.25content).
pre: Whitespace is not collapsed and word wrapping does not occur. This type of rendering is the default for <pre> tags, except the font-family of the element is not set to monospace.
Initial value: normal
CSS Version: 1
This property is fully supported in Mozilla browsers (including Netscape 6 or later), Opera, and Internet Explorer 5 for Macintosh.
Internet Explorer for Windows supports this property as of version 5.5; however, the pre value is supported only in version 6, and then only when running in standards-compliant mode.
Netscape 4 supports this property with the exception of the nowrap value.
This style rule will preserve whitespace and suppress word wrapping on div elements of class screen:
div.screen { white-space: pre; }
3.145.111.183