一旦列标题被修复,第一行表就会消失(粘性标题)(First row of table disappears once the column headers are fixed (sticky head

编程入门 行业动态 更新时间:2024-10-23 07:37:20
一旦列标题被修复,第一行表就会消失(粘性标题)(First row of table disappears once the column headers are fixed (sticky header))

我需要你的帮助,

我似乎无法弄清楚为什么表格中的第一行(ABC-123-123456)在顶部列被修复后消失或者似乎隐藏起来。 由于我的工作仍然使用IE7,我需要能够使用符合浏览器标准的粘性列标题。

<!DOCTYPE html> <html> <head> <style type="text/css"> #data_container { margin-top: 5px; width: 100%; height: 200px; overflow-x: scroll; overflow-y: scroll; border: 1px solid #ccc; position: relative; color: rgb(60,60,60); font-size: 9pt; } #data { border-collapse:collapse; border-spacing: 0; border-right: 1px solid #ccc; table-layout: fixed; } #data th { border-bottom:1px solid #ccc; border-left: 1px solid #ccc; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff", endColorstr="#dcdcdc"); font-weight: normal; } #data tr { text-align: center; } #data td { border-bottom:1px solid #ccc; border-left: 1px solid #ccc; text-align: left; padding-left: 6px; } #data tr:hover td { background: #f2f2f2; } #data th, #data td { height: 20px; width: 130px; } #data tr td:first-child, #data tr th:first-child { border-left: 0; } #data thead tr { top:expression(this.offsetParent.scrollTop); position: absolute; } #data tr:first-child td { border-top: 0; } </style> </head> <body> <div id="data_container"> <table id="data"> <!-- Table Header --> <thead> <tr> <th data-sort="string">File Number</th> <th>Test Column</th> <th>Request Type</th> <th>Resize This</th> <th>Firstname</th> <th>Lastname</th> <th data-sort="string">Progress</th> <th>Vital Task</th> </tr> </thead> <!-- Table Header --> <!-- Table Body --> <tbody> <tr> <td>ABC-123-123456</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr><!-- Table Row --> <tr> <td>ABC-123-942471</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr><!-- Darker Table Row --> <tr> <td>ABC-123-408126</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>20%</td> <td>No</td> </tr> <tr> <td>ABC-123-396225</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td>No</td> </tr> <tr> <td>ABC-123-385417</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-374250</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-408970</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-404552</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-403102</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr> <tr> <td>ABC-123-404555</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>23%</td> <td>yes</td> </tr> <tr> <td>ABC-123-406789</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td>No</td> </tr> <tr> <td><a href="#yep-iit-doesnt-exist">Hyperlink Example</a></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td><a href="#inexistent-id">Another</a></td> </tr> </tbody> <!-- Table Body --> </table> </body> </html>

I need your help,

I can't seem to figure out as to why the first row in the table (ABC-123-123456) disappears or appears to be hidden once the top columns are fixed. As my work uses IE7 still I need to be able to have a browser compliant sticky column headers.

<!DOCTYPE html> <html> <head> <style type="text/css"> #data_container { margin-top: 5px; width: 100%; height: 200px; overflow-x: scroll; overflow-y: scroll; border: 1px solid #ccc; position: relative; color: rgb(60,60,60); font-size: 9pt; } #data { border-collapse:collapse; border-spacing: 0; border-right: 1px solid #ccc; table-layout: fixed; } #data th { border-bottom:1px solid #ccc; border-left: 1px solid #ccc; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff", endColorstr="#dcdcdc"); font-weight: normal; } #data tr { text-align: center; } #data td { border-bottom:1px solid #ccc; border-left: 1px solid #ccc; text-align: left; padding-left: 6px; } #data tr:hover td { background: #f2f2f2; } #data th, #data td { height: 20px; width: 130px; } #data tr td:first-child, #data tr th:first-child { border-left: 0; } #data thead tr { top:expression(this.offsetParent.scrollTop); position: absolute; } #data tr:first-child td { border-top: 0; } </style> </head> <body> <div id="data_container"> <table id="data"> <!-- Table Header --> <thead> <tr> <th data-sort="string">File Number</th> <th>Test Column</th> <th>Request Type</th> <th>Resize This</th> <th>Firstname</th> <th>Lastname</th> <th data-sort="string">Progress</th> <th>Vital Task</th> </tr> </thead> <!-- Table Header --> <!-- Table Body --> <tbody> <tr> <td>ABC-123-123456</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr><!-- Table Row --> <tr> <td>ABC-123-942471</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr><!-- Darker Table Row --> <tr> <td>ABC-123-408126</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>20%</td> <td>No</td> </tr> <tr> <td>ABC-123-396225</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td>No</td> </tr> <tr> <td>ABC-123-385417</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-374250</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-408970</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-404552</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>ABC-123-403102</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>100%</td> <td>Yes</td> </tr> <tr> <td>ABC-123-404555</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>23%</td> <td>yes</td> </tr> <tr> <td>ABC-123-406789</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td>No</td> </tr> <tr> <td><a href="#yep-iit-doesnt-exist">Hyperlink Example</a></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>80%</td> <td><a href="#inexistent-id">Another</a></td> </tr> </tbody> <!-- Table Body --> </table> </body> </html>

最满意答案

加上这个

#data tbody{ position: absolute; top: 24px; }

add this

#data tbody{ position: absolute; top: 24px; }

更多推荐

#data,px,tr,电脑培训,计算机培训,IT培训"/> <meta name="description"

本文发布于:2023-08-07 19:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:就会   标题   粘性   table   row

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!