html - 如何在 thead 中为多行(th 和 tr)应用粘性标题?
问题描述
我正在尝试为我的数据表以角度材料获取粘性标题(具有多个 tr 和 th)。
这是我下面的css,用于头部应用粘性
scss
thead {
tr.mat-header-row {
position: sticky;
position: -webkit-sticky !important;
top: 0;
z-index: 1;
background-color: inherit !important;
}
border: 1px solid rgb(250,250,250);
background-color: #CCCCCC;
}
}
HTML文件
<thead>
<tr class="mat-header-row" *ngFor="let headerRow of headerData">
<th *ngFor="let head of headerRow" [attr.rowspan]="head.rowspan" [attr.colspan]="head.colspan" class="mat-header-cell tree-table-header" [matTooltip]="head.name" matTooltipPosition="above">
</th>
</tr>
</thead >
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
<mat-tree-node class="mat-row" *matTreeNodeDef="let mynode">...
</mat-tree-node>
<mat-tree>
内容应该是可滚动的,标题应该是粘性的,这就是确切的场景。
提前致谢。
解决方案
推荐阅读
- mysql - Datagrip IDE 无法使用 CLIENT_PLUGIN_AUTH 连接到 MySQL
- spring - Spring JMS - 关于设置持久订阅和共享订阅的默认消息侦听器容器问题
- python - ImportError:在 apache 服务器上运行时没有名为 flask 的模块错误
- java - 为 oracle 数据库执行更新时需要数据库链接名称
- javascript - 单击jquery ajax php中的注册后页面刷新
- amazon-web-services - 启动未出现在 AMI 列表中的 EC2 实例
- node.js - 如何使用 gm 模块在不保存图像的情况下获取图像流以将流数据发布到另一台服务器
- ios - 在集合视图中显示特定单元格。迅速
- angular - 在 ng-select 中添加搜索图标占位符而不是占位符文本?
- sql - 获取具有多个条件的行