多行文本溢出顯示...的方法(-webkit-line-clamp)

來源:互聯網
上載者:User

標籤:png   http   play   ima   strong   logs   property   tle   htm   

限制在一個塊元素顯示的文本的行數。

-webkit-line-clamp 是一個 不規範的屬性(unsupported WebKit property),它沒有出現在 CSS 規範草案中。

為了實現該效果,它需要組合其他外來的WebKit屬性。常見結合屬性:

  • display: -webkit-box; 必須結合的屬性 ,將對象作為Auto Scaling盒子模型顯示 。
  • -webkit-box-orient 必須結合的屬性 ,設定或檢索伸縮盒對象的子項目的相片順序 。
  • text-overflow,可以用來多行文本的情況下,用省略符號“...”隱藏超出範圍的文本 。      

 

demo.html

<div class="li_title">得力/deli LED燈立體浮雕地球儀/標準教學 高清中英文對照 內顯洋流圖行政圖地形圖 送放大鏡( Φ 30cm)</div>

 

demo.css

.shop .li_title{    width:100%;    font-size:16px;    line-height:20px;    height: 40px;    margin-bottom:40px;    overflow: hidden;    display: -webkit-box;    text-overflow: ellipsis;    -webkit-line-clamp:2;        -webkit-box-orient: vertical;}

 

 

多行文本溢出顯示...的方法(-webkit-line-clamp)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.