【发布时间】:2020-05-25 13:04:16
【问题描述】:
我在 mat-table 中插入了一张 mat-card 并将宽度设置为 width: 100%。但是当我滚动溢出时:x 从左到右不是整个包装都充满了垫卡。你知道我必须在 CSS 中优化什么吗?
我的代码:
// HTML
<div class="app-table-wrapper">
<table mat-table [dataSource]="dataSource" id="app-table">...</table>
<mat-card class="change-width"></mat-card>
</div>
// CSS
.app-table-wrapper {
position: relative;
background-color: #fbf9f9;
min-width: 200px;
overflow: auto;
padding: 0;
height: 300px;
}
.change-width {
width: 100%;
}
【问题讨论】:
-
我自己解决了这个问题。通过将 mat-card 设置为 position: sticky and left: 0 !important。
标签: css angular angular-material mat-table