用CSS为Element-UI组件设置Sticky Table Header。

问题描述 投票:1回答:1

在我的代码中,我使用了元素-UI表(https:/element.eleme.io#en-UScomponenttable。)组件。它工作得很好,但我想把表头自定义为粘性。

它提供了最大高度的内容,比如说。https:/element.eleme.io#en-UScomponenttable#table-with-fixed-columns-and-header。

但我想用它像。https:/codepen.iochriscoyierpenPrJdxb。

在CSS中,有一些关于它的技巧,比如。

th {
  background: white;
  position: sticky;
  top: 0;
  ...
}

我在想,怎么才能实现呢?有没有什么建议?

我的案例是

<div css="first-section">
  ...
</div>
<div css="second-section">
  ...
</div>
<el-table>
  ...
</el-table>

例子是: https:/codepen.iosenolatacpenqBdGvRy。

要在全屏模式下查看。https:/codepen.iosenolatacfullqBdGvRy。

css html-table css-position sticky element-ui
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.