小编Pra*_*eep的帖子

我无法使用角材料的 mat-grid-tile 自定义样式属性

我试图在每行创建 6 个图块,每个图块由左上角的金额、右上角的 + 符号、慈善机构名称下方、最左边的日期下方等组成。但一切都在中间发生。如何自定义每个 mat-grid-tile 的样式。

HTML Example

mat-grid-list cols="6" rowHeight="4:3" [gutterSize]="'10px'">
  <mat-grid-tile *ngFor="let item of items; let i=index">
    <div class="div-table">
      <div class="div-row">
        <div class="div-cell" style="font-weight: bold; font-size: medium;">{{amount | currency}}</div>  
      </div>
      <div class="div-row">
        <div>{{item.Name}}</div>
      </div>
    </div>
  </mat-grid-tile>

CSS Example


mat-grid-tile {
  background: lightblue;
}

.div-table {
  display: table;         
  width: auto;         
  background-color: #eee;         
}
.div-row {
  display: table-row;
  width: auto;
  clear: both;
}
.div-cell {
  float: left; 
  display: table-column;         
  width: 200px;         
  background-color: #ccc;  
}
Run Code Online (Sandbox Code Playgroud)

angular-material angular angular5 angular6 angular7

6
推荐指数
1
解决办法
6028
查看次数

标签 统计

angular ×1

angular-material ×1

angular5 ×1

angular6 ×1

angular7 ×1