CSS3----word-wrap(單詞換行)

來源:互聯網
上載者:User

標籤:type   css   超出   set   height   換行   總結   自動   ref   

 

代碼:

<!DOCTYPE html><html><head>    <meta charset="utf-8">  <title></title>   <style type="text/css">       .head{          margin: 0 0 0 100px;       }       .container{         margin: 0 0 0 100px;       }       .container div{        width: 230px;        height: 200px;        border: 1px solid red;        padding: 20px;       }       .d{       }       .d1{        word-wrap: normal;       }       .d2{        word-wrap: break-word;       }   </style></head><body>    <div class="head">      <h1>word-wrap 文本換行</h1>      <h2>首頁<a href="index.html"></a></h2>    </div>    <div class="container">         <h2>預設normal</h2>        <div class = ‘d‘>         阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang         sunlikesunlikesunlikesunlikesunlikesunlikesunlikesunlike         sunlike sunlike sunlike sunlike sunlike sunlike sunlike sunlike          </div>          <h2>word-wrap: normal;</h2>         <div class = ‘d1‘>         阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang         sunlikesunlikesunlikesunlikesunlikesunlikesunlikesunlike          sunlike sunlike sunlike sunlike sunlike sunlike sunlike sunlike          </div>           <h2>word-wrap: break-word;</h2>          <div class = ‘d2‘>         阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang阿理WangWang         sunlikesunlikesunlikesunlikesunlikesunlikesunlikesunlike          sunlike sunlike sunlike sunlike sunlike sunlike sunlike sunlike          </div>     </div></body></html>

  

 

 

效果1:

 

總結1:預設情況下,word-wrap的值為normal,中文字元自動換行,英文單詞不斷行

 

 

效果2:

 

總結2:設定word-wrap的值為normal時,中文字元自動換行,英文單詞不會截斷來換行,超出本分直接溢出

 

 

效果3:

 

 

總結3:設定word-wrap值為break-word時,中文自動換行,英文單詞或字元截斷換行

 

CSS3----word-wrap(單詞換行)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.