How can I add margin or padding to a container when using the Flex Layout Module?
Template:
<div class="container">
hell
<div fxLayout="column" fxLayoutAlign="center center">
<mat-card fxFill>Simple card test</mat-card>
</div>
</div>
Style:
.container{
margin: 60px;
}
I noticed it doesn't seem to be adding the correct amount of margin. You'll be able to see in the screenshot, the flex container has less margin than the text outside of it.
fxLayoutGap is used to specify gap between flex children items inside flex container. fxLayoutGap is an optional API. fxLayoutGap directive should be added to parent container i.e, flex container.
Installation of Angular Flex-Layout Use the following command to use Angular Flex layouts in your projects. After installing flex layout we need to import flexLayoutModule in our app. module. ts file as shown below.
2.0. This has been deprecated and removed.
From your project folder, run the following command to install Flex Layout: npm install @angular/flex-layout @10.0. 0-beta. 32.
you may use fxLayoutGap="20px"
You can use [style.margin] attribute.
div fxLayout="row" fxLayoutGap="12px" [style.margin-top]="'12px'" [style.margin-left]="'10px'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With