1. Make text wrap by browser
The browser itself comes with the ability to wrap text in its own line.
2. Specify how the line wrap is handled
In CSS3, you can use the Word-break property to decide for yourself how to handle the wrap.
div{
Word-break:break-all;
}
The value that the Word-break property can use
Value |
Line break rules |
IE5 or more |
Safari and Chrome |
Normal |
Use browser default line-wrapping rules |
Support |
Support |
Keep-all |
Wrap only in half-width spaces or hyphens |
Support |
Not supported |
Break-all |
Allow line wrapping within a word |
Support |
Support |
When the Word-break property uses the Break-all parameter value, the word wrap is allowed for Western text. For punctuation marks, when the Word-break attribute uses the Break-all parameter value, in Safari and chrome, punctuation is allowed at the beginning of the line, and the punctuation mark is still not allowed at the beginning of the line.
CSS3 Let text wrap--word-break properties