Angular Material:如何更改 mat-grid-tile 的顶部填充

问题描述:

我正在使用 angular-material 和 angular 5.mat-grid-tile 有它自己的顶部填充来计算使用 calc 方法.

am using angular-material with angular 5. mat-grid-tile has it's own top padding that calculates using calc method.

我想在 mat-grid-tile 上设置自定义填充.我该怎么做?

I want to set custom padding on mat-grid-tile. How can i do this?

grid tile 组件在元素本身上动态设置顶部填充,因此您需要在 CSS 中使用 !important 修饰符来覆盖它.

The grid tile component sets top padding dynamically on the element itself, so you need to use the !important modifier in your CSS to override it.

HTML:

<mat-grid-tile class="my-grid-tile"></mat-grid-tile>

CSS:

.my-grid-tile {
    padding-top: 24px !important;
}