Definition: Text wraps automatically when the length of the text is greater than the width of the container.
There will be no problems with Chinese, as well as General English words.
The general problem is a long string of English words or strings that are not separated, there are several situations:
1, the general situation (no floating; No display:inline-block;
This situation is best handled, just add word-wrap:break-word;
2, the text outside the container has floating, or have display:inline-block;
For non-FF browsers, Word-wrap:break-word; Word-break:break-all; can;
For FF browsers, because the Word-break:break-all is not recognized, the method is invalid, two ways:
Law 1: Look at the floating or display:inline-block, whether you must, if necessary, remove it; If you must, then simply rely on CSS tutorial can not achieve this goal, to turn to JS Bar.
Method 2:js, but there are some limitations to this method, only applicable to the case of plain text. There is a problem if you want to include other HTML tags in the text segment. For example, if you include a label <span></span>, so that the text in the label can be decorated, and if the break is just inside the label, the label will be corrupted and become a meaningless character.
Refer to the JS code as follows (refer to the online code):
<script>
function Tobreakword (Intlen) {
var Obj=document.getelementbyid ("FF");
var strcontent=obj.innerhtml;
var strtemp= "";
while (Strcontent.length>intlen) {
Strtemp+=strcontent.substr (0,intlen) + "& #10;";
Strcontent=strcontent.substr (intlen,strcontent.length);
}
strtemp+= "& #10;" +strcontent;
Obj.innerhtml=strtemp;
}
if (document.getElementById &&!document.all)
Tobreakword (37)
</script>
3, table layout (FF situation)
For a table layout, there is a benefit at this point, as long as the Word-wrap:break-word;overflow:hidden is set on a column/row, and then the table is table-layout:fixed; To achieve the automatic line wrapping effect.