3

我试图在显示垫卡时指定两行之间的一些间隙。但使用 flex 后显示不正确。

卡弯曲

这是 HTML 文件:-

<div fxLayout="row wrap" fxLayoutAlign="space-around">
  <mat-card class="list-card" *ngFor="let uri of urlData" fxLayoutGap="20px">
    <mat-card-header>
      <mat-card-title>{{uri.title}}</mat-card-title>
      <mat-card-subtitle>3 weeks ago</mat-card-subtitle>
    </mat-card-header>
    <img mat-card-image src="https://uU0bbBPEJvIK7H7f4qaSuQ.jpeg(58 kB)
https://uU0bbBPEJvIK7H7f4qaSuQ.jpeg
" alt="img alt title">
    <mat-card-content>
      <a href="https://medium.....64" class="mat-caption">
        {{uri.documentURL}} </a>
      <!-- <section> -->
      <mat-chip-list>
        <mat-chip>Angular</mat-chip>
      </mat-chip-list>
      <!-- </section> -->
      <p>
        {{uri.description}}
      </p>
    </mat-card-content>
    <mat-card-actions>
      <mat-icon>share_outline</mat-icon>
      <mat-icon>bookmark_outline</mat-icon>
    </mat-card-actions>
  </mat-card>
</div>

这是CSS: -

.list-card{
    max-width: 260px;
}
4

2 回答 2

1

有两种选择可以做到这一点

1:flexLayoutGap像你对row间隙所做的那样使用,但你需要自定义你的结构,因为 需要使用底部间隙flex column

2:margin-bottom在您的卡类上使用.list-card

.list-card{
   margin-bottom: 20px;
}
于 2019-12-27T09:55:21.533 回答
0

.list-card{ max-width: 260px; margin: 10px; }

试试这个代码

于 2019-12-27T09:44:27.383 回答