table td中的內容過長,顯示爲固定長度,多餘部分用省略號顯示

簡單描述:table數據過長,結果頂到下一格,影響了數據的查看佈局

解決辦法: 給table 加上style屬性   另外 給td加上style標籤修飾spa

<table class="table table-striped table-bordered table-hover table-checkable order-column" style="table-layout:fixed;" id="table1"> 

<style>
td {
white-space:nowrap;//規定文本不換行
     overflow:hidden;//關閉滾動條
     text-overflow: ellipsis;//溢出文字顯示爲省略號
}
</style> 

 說明:style="table-layout:fixed;"就是讓table的內部佈局固定大小,用width屬性調節td的長度。.net

 顯示的是XXX....並非所有的內容,這時候,td標籤的title 屬性就起到關鍵做用了,td的text同時賦值給title屬性,當鼠標放到table格上,就會顯示所有的名稱了code

效果:blog

原文連接:https://blog.csdn.net/tuntun1120/article/details/72903387   感謝!!!ip

相關文章
相關標籤/搜索