typescript Angular Material 如何对齐布局中心

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41625354/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 04:10:00  来源:igfitidea点击:

Angular Material how to align layout center

cssangularjstypescriptangular-materialmaterial-design

提问by user3862830

I have this straight out of angular material website, because im having a lot of trouble with angular material flex layout.

我有这个直接来自 angular material 的网站,因为我在 angular material flex 布局方面遇到了很多麻烦。

According to the doc about layout containerItems arranged in a row. max-height = 100% and max-width is the width of the items in the container.

根据关于 排成一行的布局容器项目的文档。max-height = 100% 并且 max-width 是容器中项目的宽度。

I tried the example provide at the doc page

我尝试了文档页面上提供的示例

    <div ng-app="myapp" ng-cloak>

<div layout="row" layout-align="center center">
  <div>one</div>
  <div>two</div>
  <div>three</div>
</div>

</div>

my content is suppose to align vertically and horizontally at the center. but instead my content is aligning horizontally but not vertically.

我的内容假设在中心垂直和水平对齐。但是我的内容是水平对齐而不是垂直对齐。

I have the code example here

这里有代码示例

回答by Adrian Bratu

<div layout-fill ng-app="myapp" ng-cloak>

<div layout="row" layout-fill layout-align="center center">
  <div>one</div>
  <div>two</div>
  <div>three</div>
</div>

</div>

please apply layout-fill on the containers that require to take up all the space

请在需要占用所有空间的容器上应用布局填充