jquery - IE8 中带有固定标题的表格

标签 jquery html css internet-explorer-8

我需要一些帮助。我尝试了 2 天来制作一个带有 tbody 的可滚动表格,但我找不到解决方案。

我的 table 是:

<table width=100% style="margin:0 0 0 -1px; border-collapse:collapse;"> 

<thead>
    <tr>        
        <th ><input type="checkbox" id="select_all" /></th> 
        <c:forEach items="${grid.heads}" var="element">  
             <th><c:out value="${element.id}"/></th>           
        </c:forEach>  
    </tr>   
</thead>

<tbody style="height:200px !important;   overflow: auto; display:block;">       
  <nested:iterate id="row" name="grid" property="data" indexId="cnt">                                                                
       <tr> 
         <td><input type="checkbox" name="list_with_checkboxes" value=<c:out value="${row[0]}"/> ></td>
             <nested:iterate id="element" name="row">  
                      <td><c:out value="${element}"/> </td>
            </nested:iterate>
       </tr>
  </nested:iterate>        
</tbody>    

</table>

我的表格呈现正确但我不能使 tbody 可滚动,因为我不知道为什么 tbody 有另一个高度然后 200px。

有什么想法吗?非常感谢!

最佳答案

似乎已经有很多答案了

Table tbody scroll in IE8

How can I let a table's body scroll but keep its head fixed in place?

<th style="width:0px;"></th>

这个现有的 fiddle 似乎可以解决它,但请查看上面链接中的其他建议- http://jsfiddle.net/venkateshwar/X8FSw/17/show/

关于jquery - IE8 中带有固定标题的表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20217146/

相关文章:

php - 使用 PHP/jQuery 替换 HTML 工具提示内容

javascript - 使用 .trigger 将事件传递给子级

javascript - jquery 如何使用子项获取父文本?

javascript - 链接到程序生成的 CSS,就好像它是一个外部文件一样?

html - 如何将此搜索表单居中?

jquery - 获取一个div的html并将其注入(inject)到另一个div旁边

javascript - 鼠标光标坐标在图像上 : Y coordinate is not integer! 这怎么可能?

php - 如何在输入字段中显示占位符名称而不是值名称

html - 如果屏幕太小,我怎样才能破坏 H1 标题

javascript - 横幅图片重定向到 href 中未定义的页面