ContosoCrafts icon indicating copy to clipboard operation
ContosoCrafts copied to clipboard

Card grid not working Styling a Razor Page | ASP.NET Core 101 [6 of 13]

Open ghost opened this issue 3 years ago • 2 comments

I had trouble making the cards show up in more than one column. I went through the Bootstrap files inside lib/bootstrap/dist/css and I couldn't find the .card-coulmns class. So I went to the Bootstrap documentation and found a different way to make the columns: https://getbootstrap.com/docs/5.1/components/card/#grid-cards ; https://getbootstrap.com/docs/5.1/layout/grid/#row-columns. Basically we use row-cols classes to define a grid.

That's the solution that worked for me.

ghost avatar Feb 22 '22 15:02 ghost

Another workaround is to add this to the style.css file.

/* BEGIN workaround bootstrap 5 dropped support for card-columns */
.card-columns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; 
}
.card-columns > .card {
  flex: 0 0 32%;
  margin: 0 2% 20px 0;
}
.card-columns > .card:nth-child(3n) {
  margin-right: 0;
}
/* END workaround bootstrap 5 dropped support for card-columns */

Crydust avatar Mar 31 '22 18:03 Crydust

That seems to resolve the issue!

Umer2451 avatar Dec 01 '22 13:12 Umer2451