问题
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?
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?
回答1:
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
来源:https://stackoverflow.com/questions/51093880/angular-material-2-container