HTML CSS Reference/CSS Attributes and Javascript Style Properties/white space

Материал из Web эксперт
Перейти к: навигация, поиск

"white-space" Example

   <source lang="html4strict">
   

<html> <body>

  Line1.
This sentence has line 1 line 2 and




line 3
This is a regular block of text.


<button onclick="myDiv.style.whiteSpace="normal";">Set whiteSpace property to:normal</button> <button onclick="myDiv.style.whiteSpace="pre";">Set whiteSpace property to: pre</button> </body> </html>


     </source>
   
  


"white-space" is applied to

   <source lang="html4strict">

+----------------+--------------------------------------------------------------+ | Applied_To |<acronym> <address> | | |<basefont> |

| |
| | |<body>
|

| | | | |currentStyle <custom> | | |

<dir> |

| |
|

| |

| | |<fieldset> | | |<form> <hn> |

| |
|

| | <isindex> | | | <label> |

| |<legend>
  • | | |<listing> <menu> | | |

      | | |

                                                            |
      |                |                                                    |
      |                |                                                |
      |                |                        style                         |
      |                |                                                    |
      |                |                                                       |
      |                |
        <xmp> | +----------------+--------------------------------------------------------------+ </source>

        "white-space" Possible Values

        <source lang="html4strict"> Possible Values normal The default; no extra white space is added. nowrap Text wrapping is turned off, line breaks are disabled. pre Content wraps to the next line;


        </source>



        "white-space" Syntax and Note

        <source lang="html4strict"> Note: How to handle white space (line breaks, spaces, tabs). Add extra space with one or more   Add extra lines with the
        element. Syntax:

        element { white-space: value } elementID.style.whiteSpace = "value" document.all.elementID.style.whiteSpace = "value" // IE only


        </source>