最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CSS之自動換行

 更新時間:2006年09月17日 00:00:00   作者:  
大家都知道連續(xù)的英文或數(shù)字能是容器被撐大,不能根據(jù)容器的大小自動換行,下面是 CSS如何將他們換行的方法!
對于div
1.(IE瀏覽器)white-space:normal; word-break:break-all;這里前者是遵循標準。

#wrap{white-space:normal; width:200px; }
或者
#wrap{word-break:break-all;width:200px;}

<div id="wrap">ddd1111111111111111111111111111111111</div>

效果:可以實現(xiàn)換行

2.(Firefox瀏覽器)white-space:normal; word-break:break-all;overflow:hidden;同樣的FF下也沒有很好的實現(xiàn)方法,只能隱藏或者加滾動條,當然不加滾動條效果更好!

#wrap{white-space:normal; width:200px; overflow:auto;}
或者
#wrap{word-break:break-all;width:200px; overflow:auto; }

<div id="wrap">ddd1111111111111111111111111111111111111111</div>

效果:容器正常,內(nèi)容隱藏

對于table

1. (IE瀏覽器)使用樣式table-layout:fixed;

<style>
.tb{table-layout:fixed}
</style>

<table class="tbl" width="80">
<tr>
<td>abcdefghigklmnopqrstuvwxyz 1234567890
</td>
</tr>
</table>

效果:可以換行

2.(IE瀏覽器)使用樣式table-layout:fixed與nowrap

<style>
.tb {table-layout:fixed}
</style>

<table class="tb" width="80">
<tr>
<td nowrap>abcdefghigklmnopqrstuvwxyz 1234567890
</td>
</tr>
</table>

效果:可以換行

3. (IE瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與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>

效果:兩個td均正常換行

4.(Firefox瀏覽器)在使用百分比固定td大小情況下使用樣式table-layout:fixed與nowrap,并且使用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>

這里單元格寬度一定要用百分比定義

效果:正常顯示,但不能換行(注:在FF下還沒有能使容器內(nèi)容換行的好方法,只能用overflow將多出的內(nèi)容隱藏,以免影響整體效果) 

相關(guān)文章

最新評論

邓州市| 洪洞县| 新田县| 和田县| 剑川县| 刚察县| 栖霞市| 特克斯县| 新郑市| 兴城市| 浮山县| 汪清县| 施秉县| 盖州市| 谷城县| 金塔县| 乌拉特中旗| 中超| 海阳市| 正阳县| 罗平县| 乌什县| 沁水县| 木兰县| 义乌市| 云安县| 凭祥市| 文山县| 千阳县| 合山市| 宁城县| 临西县| 杭锦旗| 凭祥市| 廊坊市| 滦南县| 高清| 江油市| 枝江市| 尼勒克县| 泾阳县|