When the HTML document source is authored, the browser by default will ignore any text formatting within the document apart from that enclosed in <PRE> tags. Between words, multiple spaces are collapsed to single spaces and carriage returns are ignored.
The following keywords can be used to control whitespace handling in the browser:
normal
nowrap
pre
With the normal keyword, the browser behaves as it normally would.
The nowrap keyword forces the browser to ignore line breaks. There is an implication that white space should be preserved, otherwise this setting is no different to the normal keyword.
The pre keyword honors all line breaks and whitespace in the text. Setting the pre keyword in this property retains the proportional font and simply leaves linebreaks and whitespace intact, unlike text that is enclosed in <PRE> tags, which will be rendered in a monospace font. This means that whitespace used for alignment may still not do what you expect although it may be a way of indenting text. It is not clear from the available documentation whether <BR> tags are honored inside a block styled with the pre keyword, but it is likely that they are which is also not the case when enclosing the text inside <PRE> tags. Netscape 6.0 does in fact honor <BR> tags inside an element styled with the pre value.
There are reports that the CSS syntax for this property does not work correctly on Netscape Navigator (even in version 6).
MSIE 5 meanwhile has problems with the pre value when it is applied to this property.
See also: | JSSTag.whiteSpace |
Prev | Home | Next |
style.volume | Up | style.widows |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |