css| Tips
What are the techniques for CSS wrap? We all know that the continuous English or digital can be the container is propped up, can not be based on the size of the container to automatically wrap, the following is how the CSS will be their line-wrapping Method!
We all know that the continuous English or digital can be the container is propped up, can not be based on the size of the container to automatically wrap, the following is how the CSS will be their line-wrapping Method!
for Div
1. (ie browser) white-space:normal; Word-break:break-all, where the former is to follow the standard.
#wrap {white-space:normal; width:200px;}
Or
#wrap {word-break:break-all;width:200px;}
<div id= "Wrap" >ddd111111111111111111111111111111</div>
Effect: You can implement line wrapping
2. (Firefox browser) white-space:normal; Word-break:break-all;overflow:hidden, the same FF also does not have a good implementation method, can only hide or add scroll bar, of course, without the scroll bar effect better!
#wrap {white-space:normal; width:200px; overflow:auto;}
Or
#wrap {word-break:break-all;width:200px; overflow:auto;}
<div id= "Wrap" >ddd1111111111111111111111111111111111111111</div>
Effect: Container normal, content hidden
for Table
1. (ie browser) use style table-layout:fixed;
<style>
. tb{table-layout:fixed}
</style>
<table class= "tbl" width= ">"
<tr><td>
ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890
</td></tr>
</table>
Effect: You can change lines
2. (ie browser) use style
<style>
. TB {table-layout:fixed}
</style>
<table class= "TB" width= "><TR><TD nowrap>"
ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890
</td></tr>
</table>
Effect: You can change lines
3. (ie browser) using a percentage fixed TD size case use style table-layout:fixed and nowrap
<style>
. tb{table-layout:fixed}
</style>
<table class= "TB" width=80>
<tr>
<TD width=25% nowrap>
ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890
</td>
<TD nowrap>abcdefghigklmnopqrstuvwxyz 1234567890</td>
</tr>
</table>
Effect: Two TD all normal line change
4. (Firefox browser) using a percentage fixed TD size case use style table-layout:fixed and nowrap, and use div
<style>
. TB {table-layout:fixed}
. td {Overflow:hidden;}
</style>
<table CLASS=TB width=80>
<TR><TD width=25% CLASS=TD nowrap>
<DIV>ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890</div>
</td>
<TD CLASS=TD nowrap><div>abcdefghigklmnopqrstuvwxyz 1234567890</div></td>
</tr>
</table>
Here the cell width must be defined as a percentage effect: The display is normal, but the line cannot be wrapped.
Note: Under the FF has not been able to make the container content to wrap the good method, only with overflow will be more than the content of the hidden, lest affect the overall effect.