css對html中表格儲存格td文本過長的處理

來源:互聯網
上載者:User

標籤:blog   http   ar   sp   div   log   html   bs   as   

參考 http://www.cnblogs.com/lekko/archive/2013/04/30/3051638.html

  http://www.zhangxinxu.com/wordpress/?p=4105

 

只關注實現其效果的css屬性,暫無視瀏覽器安全色性。

table{table-layout: fixed;}.autocut{width:200px;overflow: hidden;white-space:nowrap;text-overflow: ellipsis;}.autocut:hover{overflow: visible;white-space: normal;word-wrap: break-word;}

 

分別看一下達到其效果的屬性:

table-layout: fixed;

讓表格版面配置固定,也就是表格的寬度不是跟隨儲存格內容多少自動計算尺寸。

overflow: hidden;

 讓溢出的內容被裁剪,使其不可見。

white-space: nowrap

 不折行顯示。

text-overflow: ellipsis;

 溢出文本顯示省略標記...

overflow: visible;

 溢出文本可見,正常顯示。

white-space: normal;

 預設。空白會被瀏覽器忽略。這個不是很理解

word-wrap: break-word;

 在長單詞或 URL 地址內部進行換行。

css對html中表格儲存格td文本過長的處理

聯繫我們

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