Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Sets or retrieves a value that indicates whether lines are automatically broken inside the object .
This property now applies to the currentStyle element. The pre value of this property is now supported.
Syntax
{ white-space : sWrap } |
object.style.whiteSpace ( v ) [ = sWrap ] |
Possible Values
sWrap | String that specifies or receives one of the following values.
|
The property is read/write for all objects except the following, for which it is read-only: currentStyle . The property has a default value of normal . The Cascading Style Sheets (CSS) attribute is inherited.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties .
Remarks
Whitespace, such as line breaks, spaces, and tabs, is collapsed by default in HTML documents. You can use the nonbreaking space entity ( ) to add extra spaces to an object when the whiteSpace property is set to normal or nowrap . You can add extra line breaks using the br element.
This property affects content you access through the Document Object Model (DOM) the same way it affects the way Internet Explorer displays the content.
Examples
The following example shows how automatic line breaks are suppressed when the user places the mouse pointer over the paragraph. This is caused by toggling the value of the white-space attribute in the onmouseover and onmouseout events of the p element. When the white-space attribute is set to nowrap in the onmouseover event, line breaks are suppressed, and horizontal scrolling is required to view content wider than the element. When the attribute is set to normal in the onmouseout event, lines break automatically, depending on the width of the element.
<HTML>
The following example shows how to set and retrieve the value of the whiteSpace property. When the user sets the value of the whiteSpace property of a div element, the value of the property is retrieved in a span element.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
Standards Information
This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) .
Applies To
|
ACRONYM , ADDRESS , BASEFONT , BLOCKQUOTE , BDO , BIG , BODY , CENTER , CITE , CODE , currentStyle , CUSTOM , DD , DIV , DIR , DL , DT , EM , FIELDSET , FORM , FONT , hn , HR , ISINDEX , I , INS , KBD , LABEL , LEGEND , LI , LISTING , MENU , OL , P , Q , PLAINTEXT , PRE , S , SMALL , SPAN , STRIKE , STRONG , style , SUB , SUP , TT , U , UL , XMP |
Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |