当前位置:网站首页>table 固定特定行

table 固定特定行

2022-07-26 07:38:00 小明.杨

背景

在element或者antDesignVue的开发的过程中我们会遇到需要固定特定行的情况

代码

在这里通过css样式对第一行数据进行固定(非表头)

// 固定第一行 /deep/ .ant-table-tbody > tr:first-child {
    
  position: sticky !important;
  top: 0 !important;
  z-index: 1 !important;
}

说明

first-child父元素的首个元素选择器
> 表示子原素

效果图

在这里插入图片描述

原网站

版权声明
本文为[小明.杨]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45974445/article/details/125948088