小编Shu*_*ain的帖子

水平滚动上的垫表背景颜色

在我的 Angular 6 应用程序中使用时mat-table,我无法正确设置水平滚动的背景mat-header-row颜色mat-row。CSS 属性仅应用于屏幕的可见部分,一旦向右滚动,就不会分配颜色。

水平滚动背景颜色问题

我的表中有大约 30 列,因此肯定需要水平滚动。

我的CSS如下:

.mat-toolbar {
    font-size: 17px;
    font-family: inherit;
    background-color: indigo;
    max-height: 12vh;
}

.mat-elevation-z8 {
    padding: 0px;
}

.mat-table {
    overflow: auto;
    max-height: 68vh;
    min-width: 100%;
}

.mat-header-row {
    position: sticky;
    top: -.5px;
    z-index: 100;
    background-color: gainsboro;
    font-size: 12px;
    min-height: 8vh;
    color: #f5f5f5;
    padding-top: 3px;
}

.mat-row:nth-child(even) {
    background-color: floralwhite;
}

.mat-row:nth-child(odd) {
    background-color: gainsboro;
}

.mat-row {
    min-height: 8vh;
}

.no-results {
    display: flex;
    justify-content: center; …
Run Code Online (Sandbox Code Playgroud)

css angular-material angular mat-table

2
推荐指数
1
解决办法
5774
查看次数

标签 统计

angular ×1

angular-material ×1

css ×1

mat-table ×1