I’ve made a handful of changes to my base.css and card-product.liquid files to modify my product cards so that they appear in a vertical, single-column list with thumbnail images.
The problem I’m running into is that the product cards are not spacing evenly. I’d like the card spacing to be uniform and based off of the thumbnail images, so that each thumbnail is equally spaced from the next. Instead, the spacing seems to be dictated by the card text, with cards having a two-line caption (which I grab from custom metafields via the Liquid code below) getting extra vertical spacing compared to cards with a caption that’s only one line. The gap between ‘Alloy’ and ‘Beneath Lighted Coffers’, for example, is much larger than that between ‘Ki - Iro’ and ‘Oscillate’.
I don’t actually know coding and have slowly been piecing this together via Googling + trial and error. Any advice?
My additions to base.css:
@media only screen and (min-width: 750px) {
.collection .grid__item {
width: 100% !important;
max-width: 100% !important;
}
.collection .card {
justify-content: space-between !important;
align-items: center !important;
gap: 2rem;
flex-direction: initial !important;
}
.collection .card__inner {
width: 7%;
}
.collection .card__content {
width: 93% !important;
}
.collection .card__information {
display: flex;
justify-content: space-between;
align-items: center;
}
.collection .card__heading {
width: 50%;
}
.collection .card-information {
width: 50%;
text-align: right;
}
}
My changes to the card-product.liquid file have been a bit more involved:
- Modify product titles
- Display 1-2 lines (depending on the product) of metafield data as a subheader/caption
- Add an audio player
- Hide item prices (this is done with a Custom Liquid section, not in the card-product.liquid file)
It seems like only the subheader/caption code is relevant here, so I’ve bolded it below: