CSS到多个垫子响应
我有一个具有角度材料的项目,其中我正在创建一个带有几张垫子卡的组件。我要做的是根据卡的宽度使屏幕响应。
目前,只有该卡较小,但不是标题或内容。所有卡都出现在单列中。
这是我的component.html:
<div class="container">
<mat-card *ngFor="let properties of menuComponent.fillerNav" class = "mat-elevation-z4">
<mat-card-header>
<mat-card-title>
{{properties.name}}
<mat-icon class="iconMenu">{{properties.icon}}</mat-icon>
</mat-card-title>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content>
<p>
total
</p>
</mat-card-content>
</mat-card>
</div>
这是我的component.scss:
mat-card {
width: 20%
}
这是带有f12的窗口的视图:
I have a project in Angular material in which I am creating a component with several mat-cards. What I am trying to do is make the screen responsive depending on the width of the cards.
Right now only the card is made smaller but not the titles or the content. And all the cards appear in a single column.
This is my component.html:
<div class="container">
<mat-card *ngFor="let properties of menuComponent.fillerNav" class = "mat-elevation-z4">
<mat-card-header>
<mat-card-title>
{{properties.name}}
<mat-icon class="iconMenu">{{properties.icon}}</mat-icon>
</mat-card-title>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content>
<p>
total
</p>
</mat-card-content>
</mat-card>
</div>
This is my component.scss:
mat-card {
width: 20%
}
This is the view of the window with F12:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了使其在html上使用,以这种方式尝试
也是一个完整的示例如何使用Flex布局在Angular中创建响应式卡网格
To make it work on HTML try it this way
Also here is a full example how to create a responsive card grid in Angular using Flex Layout