css強制英文換行(1/2)

來源:互聯網
上載者:User
 代碼如下 複製代碼

自動換行

div{
word-wrap: break-word;
word-break: normal;
}

強制英文單詞斷行www.111cn.net

div{
word-break:break-all;
}

1.(ie瀏覽器)white-space:normal; word-break:break-all;這裡前者是遵循標準。

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

eg.
<div id="wrap">ddd111111111111111111111111111111111www.111cn.net11111111111111111111111</div>

效果:可以實現換行

2.(firefox瀏覽器)white-space:normal; word-break:break-all;overflow:hidden;同樣的ff下也沒有很好的實現方法,只能隱藏或者加捲軸,當然不加捲軸效果更好!

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

eg.

<div id="wrap">ddd11111111111111111111111111111www.111cn.net11111111111111111111</div>

效果:容器正常,內容隱藏

對於table

1. (ie瀏覽器)使用樣式table-layout:fixed;
eg.
<style>
.tb{table-layout:fixed}
</style>

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

 

 

首頁 1 2 末頁
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.