Css讓文字自適應Table寬度

來源:互聯網
上載者:User

Css讓文字自適應Table寬度[轉]

.ctl{

table-layout:fixed

}

.ctl td{text-overflow:ellipsis;overflow:hidden;white-space: nowrap;padding:2px}

關鍵樣式:

table-layout:fixed 固定式配置的演算法,則表格被呈遞的預設寬度為 100% (For IE,Mozilla)

text-overflow:ellipsis 當對象內文本溢出時顯示省略標記(...) (For IE)

overflow:hidden 不顯示超過對象尺寸的內容 (For IE,Mozilla) 

white-space: nowrap 強制在同一行內顯示所有文本,直到文本結束或者遭遇 br 對象 (For IE,Mozilla)

原文

http://www.feitec.com/showart.asp?id=825

相關文章

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.