Angular Material 2 容器 [英] Angular Material 2 container

查看:25
本文介绍了Angular Material 2 容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Angular material 2 的新手,我习惯于使用 bootstrap 4.1.所以这个问题可能看起来很简单,但是如何在 Angular 材料 2 中创建一个容器"呢?

I'm new to Angular material 2 and I'm accustomed to using bootstrap 4.1. So this question may seem simple, but how does one create a "container" in Angular material 2?

例如,在引导容器中,将为整个应用程序创建左右边距,使用 Angular 材料 2 可以轻松实现吗?

For example in a bootstrap container in will create a left and right margin for the entire app, can this be achieved easily with Angular material 2?

推荐答案

这完全取决于您的布局.如果您将所有内容都放在一张卡片中,那么您无需担心任何事情,由于设置了宽度,卡片将很好地显示出来.但是,如果您有几张卡片或者如果您希望有一个特定的布局,您总是可以通过在项目的父 .scss 中自己设置边距(名称应该是style.scss),然后它将应用于您的整个应用程序.此外,如果您使用 FlexLayout(link),您甚至可能不必设置一个边距(虽然这完全取决于你如何使用它,但我在我的应用程序中使用它,并结合材料组件,我从不介意设置任何边距来定义容器).

Well it all depends on your layout. If you have all your content in one card, you don't need to mind about anything, the card will be nicely displayed thanks to its set width. However if you have several cards or if you wish to have a particular layout, you can always achieve the same thing as you said about bootsrtap (about the margin) by setting the margin yourself in the parent .scss of your project (name should be style.scss), it will then apply to your whole app. Also, if you use FlexLayout (link) you might not even have to set a margin (it all depends on how you use it though, but I use it in my app, and combined with material components, I never had to mind about setting any margin to define a container).

所以如你所见,有很多东西可以为你做,或者你可以自己做,这完全取决于你想使用什么样的布局

So as you see there are many things that can do it for you, or you can do it yourself, it all depends on what kind of layout you want to use

这篇关于Angular Material 2 容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆