angular - 使用 flex 布局将一行图像分成两个相等的部分
问题描述
我有 8 个徽标。我在打字稿文件中创建了一个界面和一个数组。图像显示在一行中。但我想把它们分成两个相等的部分。第一行将占用四行,第二行也将占用。所以,我必须使用 angular flex 布局。
[NB]:我使用了 fxLayout="row wrap"。但它在这个阵型中显示了 3 3 2。
HTML:
<div
fxLayout="row"
fxLayoutAlign="space-around center"
fxLayoutGap="1rem"
>
<ng-container *ngFor="let iconAttribute of iconAttributes">
<div fxLayout="column" fxLayoutAlign="center center" fxLayoutGap="1rem">
<img [src]="iconAttribute.imageAttribute" alt="iconAttribute.nameAttributre" width="120">
<p>{{ iconAttribute.nameAttributre }}</p>
</div>
</ng-container>
</div>
</mat-card>
解决方案
<div fxLayout="row" fxLayoutAlign="space-around center" fxLayoutGap="1rem">
<ng-container *ngFor="let iconAttribute of iconAttributes" fxFlex="50">
推荐阅读
- c# - JWT 有效负载中的字符串/数组格式不一致
- maven - 如何使用 Java 11 和 maven 运行 XJC?
- android - 当我旋转手机时,Java andorid 绘制我的视图总是清晰的
- javascript - 格式化 HTML 打印
- image - 打开图层:如何显示与中心有一定偏移的功能的 svg 图标
- scala - Scala中的嵌套与展平模式匹配
- python-3.x - Python:在连接两个十六进制字符串时保持尾随零
- php - 从图像 Base64 字符串、PHP 创建 SVG
- google-app-engine - 有哪些方法可以限制在特定版本的 App Engine 上部署?
- soap - 生成的 Soap 客户端在 Elixir Distillery Release 中不起作用