[英]Position sticky and background-color of thead cell hides outline of tbody
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_without_z-index討論了繪制元素的順序。 position: sticky
元素被“定位”,因此被繪制在position: static
tbody
元素的頂部。 您可以使用z-index
覆蓋它。
table { border-collapse: collapse } tbody { outline: solid red; } thead tr th { background-color: green; position: sticky; z-index: -1; }
<table> <thead> <tr><th>header</th></tr> </thead> <tbody> <tr><td>content</td></tr> </tbody> </table>
如何消除邊界崩潰?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.