Within my Angular5 application, there is a container component used to display a row with multiple components arranged in n columns, as shown below:
<div class="row mx-5 my-5 h-75 w-80">
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="advancedSearchSrcdAccess">
<myComponent1></app-myComponent1>
</div>
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="simpleSearchSrcdAccess">
<myComponent2></myComponent2>
</div>
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="simpleSearchSrcdAccess">
<myComponent3></myComponent3>
</div>
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="simpleSearchSrcdAccess">
<myComponent4></myComponent4>
</div>
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="simpleSearchSrcdAccess">
<myComponent5></myComponent5>
</div>
<div class="col-md-4 col-lg-4 m-0 p-0" *ngIf="advancedSearchSrcdAccess">
<myComponent6 ></myComponent6>
</div>
....
</div>
Since the number of columns (n) varies, and I'm arranging them in groups of 3 per line (col-md-4
)
Issue: In certain scenarios, the last column fails to fill up the remaining space.
I attempted to address this using the following CSS snippet, but it did not resolve the issue:
.row :last-child {
width: 100%;
height: 100%;
}
I am seeking a solution that integrates seamlessly with Bootstrap or Angular directives, or perhaps a responsive CSS approach to achieve the desired layout:
https://i.sstatic.net/mNLxy.png
Any recommendations?