i’m a little new to the css part and i’m having trouble trying to move my checkbox block to the right and keep the other block on the left.
could you help me please?
HTML:
<mat-tab label="Permissões">
<section>
<h4>Modulos do Grupo de Segurança</h4>
<hr />
<form [formGroup]="form">
<div class="modulecheckbox">
<div *ngFor="let category of allCategories">
<h4>{{ category.description }}</h4>
<mat-checkbox
*ngFor="
let modules of filterItemsByCategory(
selectedAllModules,
category
)
"
[value]="modules.id.toString()"
>{{ modules.name }}
<div class="checkboxpermissions">
<mat-checkbox
[(ngModel)]="modules.read"
formControlName="read"
>Leitura</mat-checkbox
>
<mat-checkbox
[(ngModel)]="modules.write"
formControlName="write"
>Escrita</mat-checkbox
>
<mat-checkbox
[(ngModel)]="modules.delete"
formControlName="delete"
>Exclusão</mat-checkbox
>
</div>
</mat-checkbox>
</div>
</div>
</form>
</section>
<hr />
</mat-tab>
My css:
.checkboxpermissions{
display: inline-flex;
justify-content: space-between;
}
..modulecheckbox{
display: grid;
flex-direction: row;
}
2
Answers
You can use
flex
instead ofinline-flex
and set the grow property of the first child:here is an example: stackblitz
It’s not necessary to add a grid layout. A simple flex will do, but you need to properly use align to flex end and add a margin to the first column. Maybe this example helps:
https://codesandbox.io/s/heuristic-sound-3w38k9?file=/index.html