[英]How can I prevent this table row from appearing behind my table header?
My goal is to apply sticky headers to a table using a pure CSS approach.我的目标是使用纯 CSS 方法将粘性标题应用于表格。
Using this as a guide.以此为指导。 Table fixed header and scrollable body
表格固定标题和可滚动正文
When the page renders the table looks fine, when I start scrolling you can see a sliver of the data above the table header.当页面呈现表格时看起来不错,当我开始滚动时,您可以看到表格标题上方的一小段数据。
<div class="large-12 columns" ng-show="$ctrl.filteredParticipantsDt.length != 0">
<div style="max-height: 260px; overflow: auto;" class="tableFixHead">
<table border="1" style="width: 100%" >
<thead>
<tr>
<th><a ng-click="$ctrl.orderByField='ID_NBR'; $ctrl.reverseSort = !$ctrl.reverseSort" refresh-session>IDENTIFIER
<span ng-show="$ctrl.orderByField == 'ID_NBR'"><span ng-show="!$ctrl.reverseSort" class="fi-arrow-up"></span><span ng-show="$ctrl.reverseSort" class="fi-arrow-down"></span></span></a></th>
<th><a ng-click="$ctrl.orderByField='CNCAT_LST_FRST_M_I'; $ctrl.reverseSort = !$ctrl.reverseSort" refresh-session>PERSON
<span ng-show="$ctrl.orderByField == 'CNCAT_LST_FRST_M_I'"><span ng-show="!$ctrl.reverseSort" class="fi-arrow-up"></span><span ng-show="$ctrl.reverseSort" class="fi-arrow-down"></span></span></a></th>
<th><a ng-click="$ctrl.orderByField='SHRT_DESC'; $ctrl.reverseSort = !$ctrl.reverseSort" refresh-session>ROLE
<span ng-show="$ctrl.orderByField == 'SHRT_DESC'"><span ng-show="!$ctrl.reverseSort" class="fi-arrow-up"></span><span ng-show="$ctrl.reverseSort" class="fi-arrow-down"></span></span></a></th>
<th><a ng-click="$ctrl.orderByField='EFF_DT'; $ctrl.reverseSort = !$ctrl.reverseSort" refresh-session>EFFECTIVE DATE
<span ng-show="$ctrl.orderByField == 'EFF_DT'"><span ng-show="!$ctrl.reverseSort" class="fi-arrow-up"></span><span ng-show="$ctrl.reverseSort" class="fi-arrow-down"></span></span></a></th>
<th><a ng-click="$ctrl.orderByField='END_DT'; $ctrl.reverseSort = !$ctrl.reverseSort" refresh-session>END DATE
<span ng-show="$ctrl.orderByField == 'END_DT'"><span ng-show="!$ctrl.reverseSort" class="fi-arrow-up"></span><span ng-show="$ctrl.reverseSort" class="fi-arrow-down"></span></span></a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="a in $ctrl.filteredParticipantsDt|orderBy:$ctrl.orderByField:!$ctrl.reverseSort"
ng-click="$ctrl.setSelected(a)"
ng-class="{Highlight: a.PCR_ID === $ctrl.Selected.PCR_ID, endDatedRow: a.END_DATED_IND == 'Y'}" refresh-session>
<td>{{a.ID_NBR}}</td>
<td>{{ a.CNCAT_LST_FRST_M_I }}</td>
<td>{{a.SHRT_DESC}}</td>
<td>{{a.DISPLAYEFF}}</td>
<td>{{a.DISPLAYEND || ''}}</td>
</tr>
</tbody>
</table>
</div>
</div>
I know its a bit late to answer, but I had this exact issue.我知道回答有点晚了,但我遇到了这个确切的问题。 The problem is the table header has an invisible border that needs to be removed in order to not see that extra pixel behind it.
问题是表格标题有一个不可见的边框,需要删除它才能看不到它后面的额外像素。 The inline solution for brevity sake:
为简洁起见,内联解决方案:
<div class="large-12 columns" ng-show="$ctrl.filteredParticipantsDt.length != 0">
<div style="max-height: 260px; overflow: auto;" class="tableFixHead">
<table border="1" style="width: 100%" >
<thead>
<tr(style="border-style:hidden")>
. . .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.