gpt4 book ai didi

css - 如何将 MatTable 中的特定单元格扩展到行高的 100%?

转载 作者:行者123 更新时间:2023-12-05 01:00:00 35 4
gpt4 key购买 nike

由于某些原因,设置 height:100% 不起作用。 enter image description here

关于如何仅将给定单元格(红色单元格)扩展到 100% 行高的任何想法?

Stackblitz 适合您

https://stackblitz.com/edit/angular-927yqj?file=app/table-basic-example.css

<div class="example-container mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">

<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->

<!-- Position Column -->
<ng-container matColumnDef="position">
<mat-header-cell *matHeaderCellDef> No. </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.position}} </mat-cell>
</ng-container>

<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
</ng-container>

<!-- Weight Column -->
<ng-container matColumnDef="weight">
<mat-header-cell *matHeaderCellDef> Weight </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.weight}} </mat-cell>
</ng-container>

<!-- Symbol Column -->
<ng-container matColumnDef="symbol">
<mat-header-cell *matHeaderCellDef> Symbol </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.symbol}} </mat-cell>
</ng-container>

<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
</div>

CSS

.example-container {
display: flex;
flex-direction: column;
max-height: 500px;
min-width: 300px;
}

.mat-table {
overflow: auto;
max-height: 500px;
}

.mat-column-symbol{
background-color:red;
height:100%;
}

最佳答案

试试这个:

.mat-column-symbol{
background-color:red;
align-self: stretch;
display:flex;
align-items:center;
}

关于css - 如何将 MatTable 中的特定单元格扩展到行高的 100%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50860003/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com