79375315

Date: 2025-01-21 17:19:40
Score: 1.5
Natty:
Report link

Upgrading from bootstrap 4 to 5.3 and had to migrate the deprecated card-columns class. Bootstrap suggests a third party library for masonry (https://getbootstrap.com/docs/5.3/components/card/#masonry). As @raj-bhatia suggested I also use ngx-masonry which is the ng wrapper around said library.

The bootstrap example (https://getbootstrap.com/docs/5.3/examples/masonry/) would look in Angular like this:

<ngx-masonry [options]="{ percentPosition: true }" class="row">
    <div *ngFor="let col of columns" class="col-sm-6 col-lg-4" ngxMasonryItem>
        <div class="card">{{ col }}</div>
    </div>
</ngx-masonry>

I noticed that the gutters option did not work well with bootstrap5, so use the gutters class for the row instead (e.g.: class="row g-3")

Reasons:
  • Blacklisted phrase (1): did not work
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @raj-bhatia
  • Low reputation (0.5):
Posted by: Delta