HTML CSS Reference/CSS Attributes and Javascript Style Properties/word break

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

"word-break" Example

    
<html>
<body>
<div id="myD" 
     style="width:300px; background-color:beige;">
This is a sample paragraph. 
This is a sample paragraph. 
This is a sample paragraph. 
This is a sample paragraph. 
This is a sample paragraph.This is a sample paragraph. 
This is a sample paragraph. 
This is a sample paragraph.This is a sample paragraph. 
This is a sample paragraph.
</div>
<br>
<input type="button" 
       value="Set wordBreak property to break-all" 
       onclick="myD.style.wordBreak="break-all"">
</body>
</html>



"word-break" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<address>                       <blockquote>                  |
|                |<body>                          <center>                      |
|                |currentStyle                    <dd>                          |
|                |<dir>                           <div>                         |
|                |<dl>                            <dt>                          |
|                |<fieldset>                      <form>                        |
|                |<hn>                            <hr>                          |
|                |<legend>                        <li>                          |
|                |<listing>                       <marquee>                     |
|                |<menu>                          <ol>                          |
|                |<p>                             <pre>                         |
|                |runtimeStyle                    style                         |
|                |<table>                         <td>                          |
|                |<th>                            <tr>                          |
|                |<ul>                            <xmp>                         |
+----------------+--------------------------------------------------------------+



"word-break" Possible Values

Possible Values
normal         default; normal line breaks
break-all      normal for Asian text
keep-all       Allows line breaking for non-Asian text and
               does not allow line breaking for Asian text



"word-break" Syntax and Note

Note:
How to break lines.
When working with a table, you must set the table-layout property to fixed.
Syntax:
    
element { word-break: value }
elementID.style.wordBreak = "value"
document.all.elementID.style.wordBreak = "value"