Angular Flex Layout refuses to center container horizontally, applied directives to div, router outlet, everything, yet it still wont center

SebastianG

Recording of the elements insepcted: https://streamable.com/nmhaa

The container within 'interactive-models' will simple not center inside his parent container.

in App Component Html:

<router-outlet fxLayout="column" fxFlexAlign="center" fxLayoutAlign="center center">

Inside Interactive-models commponent.html:

<div fxLayout="row" fxLayoutAlign="center center" 

fxHide.lt-md="true" class="container theStupidList" fxFlex="90%">

The Material grid list:

<mat-grid-list class="item" fxFlex="90" fxFlexAlign="center"  
cols="3" rowHeight="600" gutterSize="15px">

In my CSS:

.theStupidList {
justify-content: center!important;
justify-self:center !important;
justify-items: center!important; }
Uncle_Jerry

I may be wrong here, but the component that you’re trying to display inside the router isn’t actually outlet’s child (it’s would be a sibling) if you look in the DOM. Therefore you need to flex the parent that holds the outlet. Just wrap the outlet in a div and center the the children.

<div fxLayout=“row” fxLayoutAlign=“center center”>

If you would like you can also set the fxFlexFill on that parent div to make sure it take the whole available space

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Unable to center div horizontally, position fixed involved

分類Dev

How to center an iframe horizontally?

分類Dev

How do I horizontally center a span element inside a div

分類Dev

How do you easily horizontally center a <div> using CSS?

分類Dev

How to vertically and horizontally center two images inside a div on a responsive page

分類Dev

React Native: render layout with form in center, and flex background

分類Dev

XHTML 1.0 Strict - div align="center" still working?

分類Dev

Center the Text of QTextEdit horizontally and vertically

分類Dev

Why is not center this layout?

分類Dev

Div container won't center using CSS & HTML

分類Dev

Center text over a flex element

分類Dev

How to make a heading with image and text horizontally center?

分類Dev

Horizontally center MatDialog with 100% width and fixed maxWidth

分類Dev

Center an image horizontally with CSS, on top of a background video

分類Dev

CSS: Cannot center a div

分類Dev

Center a dynamic <div> on screen

分類Dev

Put div in center

分類Dev

bootstrap center progressbar on div

分類Dev

Center link vertically in a div

分類Dev

How to align <div> to center?

分類Dev

Flex-growは<router-outlet>のAngularでは機能しません

分類Dev

Center a widget in a layout with Qt Designer

分類Dev

Center header text in a container on mobile

分類Dev

align two SVGs at the center of their container

分類Dev

Three column layout - middle one dynamic width, other two fill up the rest of the container and center the middle one

分類Dev

Center absolute div in another div

分類Dev

Angular MaterialとIE: Internet Explorerでlayout-align="center center"ができない

分類Dev

Nested outlets in master layout outlet in angular 6

分類Dev

Modules with router-outlet in Angular 4/5

Related 関連記事

  1. 1

    Unable to center div horizontally, position fixed involved

  2. 2

    How to center an iframe horizontally?

  3. 3

    How do I horizontally center a span element inside a div

  4. 4

    How do you easily horizontally center a <div> using CSS?

  5. 5

    How to vertically and horizontally center two images inside a div on a responsive page

  6. 6

    React Native: render layout with form in center, and flex background

  7. 7

    XHTML 1.0 Strict - div align="center" still working?

  8. 8

    Center the Text of QTextEdit horizontally and vertically

  9. 9

    Why is not center this layout?

  10. 10

    Div container won't center using CSS & HTML

  11. 11

    Center text over a flex element

  12. 12

    How to make a heading with image and text horizontally center?

  13. 13

    Horizontally center MatDialog with 100% width and fixed maxWidth

  14. 14

    Center an image horizontally with CSS, on top of a background video

  15. 15

    CSS: Cannot center a div

  16. 16

    Center a dynamic <div> on screen

  17. 17

    Put div in center

  18. 18

    bootstrap center progressbar on div

  19. 19

    Center link vertically in a div

  20. 20

    How to align <div> to center?

  21. 21

    Flex-growは<router-outlet>のAngularでは機能しません

  22. 22

    Center a widget in a layout with Qt Designer

  23. 23

    Center header text in a container on mobile

  24. 24

    align two SVGs at the center of their container

  25. 25

    Three column layout - middle one dynamic width, other two fill up the rest of the container and center the middle one

  26. 26

    Center absolute div in another div

  27. 27

    Angular MaterialとIE: Internet Explorerでlayout-align="center center"ができない

  28. 28

    Nested outlets in master layout outlet in angular 6

  29. 29

    Modules with router-outlet in Angular 4/5

ホットタグ

アーカイブ