Automatic line-wrapping problem, the normal character of the line is more reasonable, and continuous numbers and English characters will often be large containers, quite a headache, the following is a CSS how to implement the method of line-wrapping
Best CSS definition for line-wrapping code
. wrap {table-layout:fixed; word-break:break-all; overflow:hidden;}
Here Overflow:hidden, or auto;
=================================================================
For block-level elements such as Div,p
Wrapping of normal text (Asian and non-Asian text) elements have a default white-space:normal, which is automatically wrapped when the width is defined
Html
<div id= "Wrap" > Normal text Wrapping (Asian and non-Asian text) elements have the default white-space:normal, when defined </div>
Css
#wrap {white-space:normal; width:200px;}
1. (ie browser) consecutive English characters and Arabic numerals, using Word-wrap:break-word or Word-break:break-all;
#wrap {word-break:break-all; width:200px;}
Or
#wrap {word-wrap:break-word; width:200px;}
<div id= "Wrap" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
Effect: You can implement line wrapping
2. (Firefox browser) consecutive English characters and Arabic numerals break, all versions of Firefox did not solve this problem, we have to let go beyond the bounds of the characters hidden or, add a scroll bar to the container
#wrap {word-break:break-all; width:200px; overflow:auto;}
<div id= "Wrap" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
Effect: Container normal, content hidden
For table
http://www.knowsky.com/
1. (ie browser) use table-layout:fixed; Force table width, superfluous content hide
<table style= "table-layout:fixed" width= ">"
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss
</td>
</tr>
</table>
Effects: Hide Unwanted content
2. (ie browser) use table-layout:fixed; Force table width, inner td,th use word-break:break-all; or word-wrap:break-word; line-Wrapping
<table width= "style=" table-layout:fixed; >
<tr>
<TD width= "25%" style= "Word-break:break-all; ">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
<TD style= "Word-wrap:break-word;" >ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890
</td>
</tr>
</table>
Effect: You can change lines
3. (ie browser) in the td,th nested div,p, etc. using the above mentioned Div,p line-wrapping method
4. (Firefox browser) use table-layout:fixed; Force table width, inner td,th use word-break:break-all; or Word-wrap:break-word; Use Overflow:hidden; hide beyond content, here Overflow:auto; can't work
<table style= "table-layout:fixed" width= ">"
<tr>
<TD width= "25%" style= "Word-break:break-all; Overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<TD width= "75%" style= "Word-wrap:break-word; Overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>
Effects: Hide more than content
5. (Firefox browser) in the td,th nested div,p, etc. using the above mentioned methods to deal with Firefox
Run Code Box
Finally, the probability of this phenomenon is very small, but can not exclude users of the spoof.
Here is the effect of the example mentioned
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Character Wrapping </title>
<style type= "Text/css" >
Table,td,th,div {border:1px green solid;}
Code {font-family: "Courier New", Courier, monospace;}
</style>
<body>
<div style= "White-space:normal; width:200px; " >wordwrap still occurs in a TD element this has its WIDTH attribute set to a value smaller than the unwrapped content O f the cell, even if the noWrap is set to true. Therefore, the WIDTH attribute takes precedence over the NoWrap property in this scenario</div>
<div style= "Word-wrap:break-word; width:200px; " >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<div style= "word-break:break-all;width:200px;" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<div style= "Word-break:break-all; width:200px; overflow:auto;" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<table style= " Table-layout:fixed "width="
<tr>
<td> Abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<table width= style= "table-layout:fixed";
<tr>
<td width= "25% style=" Word-break:break-all; ">ABCDEFGHIGKLMNOPQRSTUVWXYZ1234567890SSSSSSSSSSSSSS</TD>
<td style=" Word-wrap:break-word; " >abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<table style= "table-layout:fixed" width= "
<tr>
<td width=" 25% "style=" Word-break : Break-all; Overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<td width=" 75% "style=" Word-wrap:break-word: Hidden ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>
</body>
< /html>