My current project involves creating a card that includes a header, image, content, and call-to-action button. When viewed on mobile devices, I have divided the card into two columns: the left column contains the header, content, and CTA, while the right column displays the image.
grid-template-columns: 2fr 1fr;
grid-template-areas:
"header image"
"content image"
"cta image";
For regular desktop view, the card is displayed in a single column with the order of header, image, content, and CTA.
I've encountered an issue trying to vertically align the image in the mobile view. The image remains stuck at the top. I attempted using align-self: center;
on .c-productCard__image as suggested on css-tricks, but it didn't work. Since I'm not very experienced with grid templates, any tips or advice would be greatly appreciated.