How to center vertically with Angular Flex Layout?

后端 未结 3 594
迷失自我
迷失自我 2020-12-30 02:35

I\'ve created a simple login component and I\'d like to vertically center, but I\'m not sure how to achieve this using the Angular Flex Layout library.

app.component

3条回答
  •  孤城傲影
    2020-12-30 03:00

    Vertically centering elements with flexbox has no effect if the container element is the same height as its contents. Making the top level

    in your example take up all the available vertical space with height: 100% (or some other Angular Flex Layout specific solution if available - maybe fxFlexFill) should center its contents right where you want them.

提交回复
热议问题