Javascript examples for CSS Style Property:wordBreak
The wordBreak property sets and gets line breaking rules for non-CJK scripts.
Value | Description |
---|---|
normal | Default value. Break words according to their usual rules |
break-all | Lines may break between any two letters |
keep-all? | Breaks are not between pairs of letters |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | normal |
Return Value: | A String, representing the word-break property of an element |
CSS Version | CSS3 |
Break words between any two letters:
<!DOCTYPE html> <html> <head> <style> #myDIV {// w w w . j av a 2 s .c o m width: 150px; height: 100px; background-color: lightblue; border: 1px solid black; } </style> </head> <body> <div id="myDIV">Thisword1thisthisthisthisthisthis23123123123</div> <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myDIV").style.wordBreak = "break-all"; } </script> </body> </html>