[英]How to position a font-awesome icon behind a scrolling table header?
我有下表:
<div id="table-container>
<table>
<thead>
<tr>
<td>
...
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<fa-stack>
<!-- some stacked icons -->
</fa-stack>
</td>
</tr>
</tbody>
<!-- more tbody items -->
</table>
</div>
我在滾動時使用 javascript 來固定表格標題:
document.getElementById('table-container').addEventListener('scroll', function (): void {
let translate = 'translate(0,' + this.scrollTop + 'px)';
this.querySelector('thead').style.transform = translate;
});
我的問題是,堆疊的字體很棒的圖標出現在表格標題之前。 嘗試使用 z-index 將它們隱藏在其后面是行不通的。
當我從 font-awesome 類中刪除 position:absolute/position:relative 屬性時,圖標消失在標題后面。 但后來它們不再堆疊了。 有什么建議么?
這是一個顯示問題的代碼筆: https ://codepen.io/ahouben/pen/jaZbvm
我在 thead 和 th 元素上設置了 z-index,我發現 thead 滑過 fontawesome 圖標的頂部。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.