二维表格固定首行也固定首列

来源:9-7 表格布局详解

一阵风_

2022-03-12

假如是个二维表格,意味着我既要thead tr 固定,也要内容的前两列固定,可以吗,如何实现?

自己试了下,固定了前两列,首行sticky就失效了。。

代码如下

table thead tr {
position: sticky;
top: 0;
background-color: white;
}

table tr td:nth-of-type(1),table tr th:nth-of-type(1){
    position: sticky;
    left: 0;
    background-color: white;
}
写回答

1回答

一阵风_

提问者

2022-03-12

其他同学已经提问过了 不好意思。看到了答案是:z-index

0
0

前端内功修炼 5大主流布局系统进阶

前端内功修炼:5大主流布局系统进阶

758 学习 · 231 问题

查看课程