<body style="direction: ltr;" leftmargin="2" topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart="return false" onselect="document.selection.empty()" oncopy ="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()" marginheight="0" marginwidth="0">消除右鍵點擊複製的程序 本文介紹如何使用css讓英文文字自動換行,大家都知道連續的英文或數字能是容器被撐大,不能根據容器的大小自動換行,以下是CSS如何將他們自動換行的方法! 大家都知道連續的英文或數字能是容器被撐大,不能根據容器的大小自動換行,以下是CSS如何將他們自動換行的方法!對於Div和table以及不同的瀏覽器,實作css自動換行的方法都稍有不同,以下分別介紹: 對於div 1.(IE瀏覽器)white-space:normal; word-break:break-all;這裡前者是遵循標準: div css xhtml xml Example Source Code Example Source Code [www.52css.com] 或者: #wrap{word-break:break-all;width:200px;} 效果:可實現自動換行 2.(Firefox瀏覽器)white-space:normal; word-break:break-all;overflow:hidden;同樣的FF下也沒有很好的實現方法,只能隱藏或者加滾動條,當然不加滾動條效果更好! div css xhtml xml Example Source Code Example Source Code [www.52css.com] 或者: #wrap{word-break:break-all;width:200px; overflow:auto; } 效果:容器正常,內容隱藏 1. (IE瀏覽器)使用樣式table-layout:fixed: div css xhtml xml Example Source Code Example Source Code [www.52css.com] 效果:可以自動換行 2.(IE瀏覽器)使用樣式: div css xhtml xml Example Source Code Example Source Code [www.52css.com] 效果:可以自動換行 3. (IE瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與nowrap: div css xhtml xml Example Source Code Example Source Code [www.52css.com] 效果:兩個td均正常自動換行 4.(Firefox瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與nowrap,並且使用div: div css xhtml xml Example Source Code Example Source Code [www.52css.com] 這裡單元格寬度一定要用百分比定義效果:正常顯示,但不能換行。
#wrap{white-space:normal; width:200px; }
<div id="wrap">ddd111111111111111111111111111111</div>
#wrap{white-space:normal; width:200px; overflow:auto;}
<div id="wrap">ddd11111111111111111111111111111111111111111</div>
http://font.knowsky.com/
對於table
<style>
.tb{table-layout:fixed}
</style>
<table class="tbl" width="80">
<tr><td>
abcdefghigklmnopqrstuvwxyz 1234567890
</td></tr>
</table>
<style>
.tb {table-layout:fixed}
</style>
<table class="tb" width="80"><tr><td nowrap>
abcdefghigklmnopqrstuvwxyz 1234567890
</td></tr>
</table>
<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>
<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>