Adr*_*ian 5 angular-material angular-flex-layout angular
我有一个图像库,我想在基于宝丽来卡的系统中显示它们,跨越多行和多列.我面临的问题与图像的布局有关.当图像同时是纵向和横向时,横向图像的mat-card属性会变得臃肿,以匹配纵向的尺寸.如何使用自然填充系统,垫卡可以适应图像的宽高比?
HTML:
<div fxLayout="row">
<div layout="column">
<div fxFlex="100" fxFlexOffset="1" fxLayoutWrap fxLayoutGap="2rem" class="mat-elevation-z0" *ngIf="postcards != null">
<mat-card *ngFor="let postcard of postcards let index = index" >
<img mat-card-image src="{{postcard.img}}" alt="{{postcard.postcard_id}}" class="postcards" (click)="display_postcard(index)">
</mat-card>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.postcards {
max-width: 320px;
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我认为你正在寻找的是fxLayoutAlign
财产。
尝试像这样添加fxLayoutAlign="start start"
到您的:div
<div fxFlex="100" fxFlexOffset="1" fxLayoutWrap fxLayoutGap="2rem" fxLayoutAlign="start start" class="mat-elevation-z0" *ngIf="postcards != null">
Run Code Online (Sandbox Code Playgroud)
PS如果您想尝试不同的选项,请查看Flex-Layout 演示。
归档时间: |
|
查看次数: |
1767 次 |
最近记录: |