2011-11-24 110 views
3

我在表列中有一些文本比我想要的列寬大。所以文本正在從中溢出。所以我應用overflow:auto,但在這種情況下,它顯示的數據小於列寬度的每個頁面上滾動。表列文本大於列寬?

我不想在該頁面上顯示數據小於列寬度的滾動只是想顯示數據大於其長度的位置。

有沒有人有一些建議?

<td style=" width:50%;overflow:auto;>  
+0

嘗試包裹TD內容與固定的寬度和溢出DIV:自動。 – rogal111

+0

謝謝你很好,謝謝你。 –

+0

我已經添加了答案,請投票。 – rogal111

回答

2

嘗試包裹TD內容在DIV與固定widthoverflow: auto

例如:

<table> 
    <tr> 
    <td>some content</td> 
    <td> <!-- your fixed width column --> 
     <div style="width: 100px; overflow: scroll;"> 
      Loremipsumdolorsitametconsectetuadipisicingelit 
     </div> 
    </td> 
    </tr> 
</table> 
1
use this <td style=" width:50%;overflow:scroll;"> 
This will insert horizontal and vertical scrollbars. 
They will become active only if the content requires it.