2015-05-13 21 views
0

我有一個只有一行的表,但每列都有一個下拉列表,其中有很多選項。溢出在行中作爲下拉列表在表格中滾動

我想有一個溢出y作爲滾動。我試圖把風格,但它沒有發生。

<table id="DisplayTable" border="5" RULES=ROWS FRAME=HSIDES class='border'><tr> 
       <th>value</th> 
       <th>IN</th>  
       <th>OUT</th> 
      </tr> 
      <tr><td> 
     <c:forEach items="${abc}" var="user"> 
       <option value="${user.name}">${user.name}</option><br> 

     </c:forEach> 
     </td> 
     <td> 
      <c:forEach items="${abc}" var="user"> 

        <c:if test="${not fn:containsIgnoreCase(user.name, 'IN')}"> 
         <option>X</option><br> 
        </c:if> 

     </c:forEach> 
     </td> 
     <td> 
      <c:forEach items="${abc}" var="user"> 

        <c:if test="${not fn:containsIgnoreCase(user.name, 'OUT')}"> 
         <option>X</option><br> 
        </c:if> 

     </c:forEach> 
     </td> 
     </tr> 
     </table> 

名稱可以是30-40,但我只想在屏幕上顯示15。作爲滾動休息。 我試着用下面的CSS,但失敗了。

table.border tr th, table tr td { 
     color: #008BFC; 
     font-size: 14px; 
     font-weight: bold; 
     padding: 8px 10px 9px; 
     text-align: left; 
    } 
    thead.border th { 
     border-right: 1px solid #eeeeee !important; 
     border-top: 2px solid #eeeeee; 
     text-align: left; 
     vertical-align: middle; 
     } 
    #DisplayTable { 
      width: 50%; 
      height: 400px; 
      overflow-y: scroll; 
     } 

回答

0

我解決了這個問題。在表格前添加<div style="height: 400px; width: 750px; overflow-y: scroll;">