2016-03-31 18 views
1

如何使表格數據僅可滾動(不是整個表格或行,只是一個單元格)?這是我能做的最好的,但顯示:塊;使所有的表格單元具有相同的大小。 (用不同的顯示或無顯示,滾動條出現,但隨着細胞變得更大太不滾動)HTML表格中的滾動條僅限數據

<table border="1" width="100%" height="100%"> 
     <tr> 
      <td rowspan="2" width="30%" height="10%"> 

      </td> 
      <td width="60%" ><font color="#FFF" style="font-weight:bold"> 
       <p>Coventry University - CV1 5FB</p> 
      </td> 
     </tr> 

     <tr> 
      <td height="90%" style="display:block; overflow-y: scroll; "><font color="#FFF"> 
       <p>I WANT THIS CELL TO BE SCROLLABLE</p> 
      </td> 
     </tr> 
    </table>  

enter image description here

+0

http://stackoverflow.com/questions/4050076/how-to-always-show-the-vertical-scrollbar-in-a-browser – Gendarme

+0

^那麼,該鏈接回答整個瀏覽器窗口的滾動條,這只是一個表格單元格。我嘗試過將一些CSS組合在一起,但我失敗了,這就是爲什麼我發佈了這個問題。 – user3926730

+0

你不能只把這個CSS放在你的表格單元中而不是正文中? – Gendarme

回答

1
<table border="1" width="100%" height="100%"> 
    <tr> 
     <td rowspan="2" width="30%" height="10%"> 

     </td> 
     <td width="60%" ><font color="#FFF" style="font-weight:bold"> 
      <p>Coventry University - CV1 5FB</p> 
     </td> 
    </tr> 

    <tr> 
     <td height="90%"><font color="#FFF"> 
      <p style="display:block; overflow-y: scroll; ">I WANT THIS CELL TO BE SCROLLABLE</p> 
     </td> 
    </tr> 
</table>  

我想這是你想要的東西; 我建議不要給「td」溢出,但可以添加溢出包括「td」;