如何在同一行显示两张垫卡

时间:2018-05-05 18:48:42

标签: angular5

我想知道卡片数量未知,并且每行显示两张卡片

<mat-card class="example-card">
  <mat-card-header>
    <div mat-card-avatar class="example-header-image"></div>
    <mat-card-title>{{user.firstName}}</mat-card-title>
    <mat-card-subtitle>{{user.lastName}}</mat-card-subtitle>
  </mat-card-header>
  <mat-card-content>
    <p>
      The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan.
      A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally
      bred for hunting.
    </p>
  </mat-card-content>
  <mat-card-actions>

  </mat-card-actions>
</mat-card>

我正在使用角度5和材料设计6 无论如何要做到这一点?

2 个答案:

答案 0 :(得分:6)

Spent hours on this... turned out to be trivial: simply add float:left to your class CSS. In my case it looked like this:

.example-card {
    max-width: 300px;
    margin-bottom: 50px;
    float: left;
}

答案 1 :(得分:1)

尝试将display: inline-block !important添加到您的.example-card类中。