html - 向上滚动时的 Angular Material Table 标题与主标题的框阴影重叠
问题描述
当我向上滚动页面时,表格标题会重叠到主标题的阴影上,如下面的屏幕截图所示:
请在下面找到 Angular Mat 表的 HTML 代码:
<ng-container>
<h1 id="opportunity-header" style="margin-left: 7.5%; margin-top: 22px;">
Opportunities - {{ accountName }}
</h1>
<div class="opportunity-container">
<table mat-table [dataSource]="opportunityList">
<ng-container matColumnDef="position">
<th *matHeaderCellDef mat-header-cell mat-sort-header>
No.
</th>
<td *matCellDef="let element; let i = index" mat-cell>
{{ i + 1 }}
</td>
</ng-container>
<ng-container matColumnDef="name">
<th *matHeaderCellDef mat-header-cell class="nameColumn">
Name
</th>
<td *matCellDef="let element" mat-cell class="name">
{{ element.getName() }}
</td>
</ng-container>
<ng-container matColumnDef="isAssociated">
<th *matHeaderCellDef mat-header-cell class="isAssociatedColumn">
isAssociated ({{ opportunityAssociated() }})
</th>
<td *matCellDef="let element" mat-cell class="isAssociated">
{{ element.getIsAssociated() ? "Yes" : "No" }}
</td>
</ng-container>
<ng-container matColumnDef="stage">
<th *matHeaderCellDef mat-header-cell class="stageColumn">
Stage
</th>
<td *matCellDef="let element" mat-cell class="stage">
{{ element.getStage() }}
</td>
</ng-container>
<ng-container matColumnDef="amount">
<th *matHeaderCellDef mat-header-cell class="amountColumn">
Amount
</th>
<td *matCellDef="let element" mat-cell class="amount">$ {{ element.getAmount() }}</td>
</ng-container>
<tr *matHeaderRowDef="displayedColumns; sticky: true" mat-header-row></tr>
<tr *matRowDef="let row; columns: displayedColumns" mat-row></tr>
</table>
<div *ngIf="opportunities?.length == 0" class="empty-record">
No Opportunities
<mat-divider class="empty-divider"></mat-divider>
</div>
</div>
</ng-container>
CSS 代码:
.opportunity-container {
height: 251px;
margin-left: 7.5%;
margin-bottom: 35px;
overflow: auto;
}
.table {
width: 100%;
}
.empty-record{
padding-top: 62px;
padding-bottom: 27px;
text-align: center;
}
.empty-divider{
margin-top: 55px;
}
.empty{
margin-left: 64px;
}
.table{
padding-top: 25px;
}
th.mat-header-cell, td.mat-cell, td.mat-footer-cell{
text-align: center;
width: 229px;
}
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background-color: transparent;
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: var(--gray-600);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--gray-700);
}
:host {
margin: 1.3em 0 0;
}
向上滚动页面时,垫子表与我的主标题栏(黄色)重叠,它也与主标题的阴影重叠,如红色框内的第二张图像所示。
任何帮助将不胜感激。
解决方案
我在 mat-toolbar 上使用 z-index:99999 而不是 z-index: 1 并且它有效!!!!
推荐阅读
- python - Python Django:从模型 CharField 中删除 null=true
- spring - java-graphql - 无法将类型定义与 java 类型匹配
- eclipse - BIRT Eclipse - 无法识别“?”附近的输入
- javascript - 模态关闭后控制到父屏幕
- spring - weblogic上的spring-boot rest应用程序
- php - 头文件中的php变量
- amazon-web-services - 如何删除/撤消/删除 Amazon Aurora RDS 上的待处理修改?
- c - 选择排序算法 (C)
- java - DB2 自动增量主键列在 Spring Boot 中不与 JPA 实体一起使用
- java - Dockers 上的多模块 Maven 项目