我正在尝试使用Angular Material创建一个mat-grid-list,问题是我在页面上看不到任何东西出现
这是我的组件info-section:
<div class="mat-grid-list" cols="4" rowHeight="100px">
<div class="mat-grid-tile" style="grid-column: span 1; grid-row: span 2; background-color: lightpink;">
Three
</div>
<div class="mat-grid-tile" style="grid-column: span 0; grid-row: span 0; background-color: lightgreen;">
Two
</div>
<div class="mat-grid-tile" style="grid-column: span 3; grid-row: span 1; background-color: #DDBDF1;">
Four
</div>
</div>
一切都已安装和声明
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
您需要使用Angular Material的网格列表组件。不仅仅是CSS。 请参考示例https://material.angular.io/components/grid-list/examples
grid-column和grid-row属性需要适当的span值来确定一个网格块应该跨越多少列或行。
<mat-grid-list cols="4" rowHeight="100px"> <mat-grid-tile colspan="1" rowspan="2" style="background-color: lightpink;"> Three </mat-grid-tile> <mat-grid-tile colspan="1" rowspan="2" style="background-color: lightgreen;"> Two </mat-grid-tile> <mat-grid-tile colspan="3" rowspan="1" style="background-color: #DDBDF1;"> Four </mat-grid-tile> </mat-grid-list>