I want to change the aspect ratio of the product cards within a featured collection to be portrait on mobile only.
Currently, the product cards are square which works perfectly with the desktop version of my website, but is there a way to change them to portrait for the mobile-only version?
To change the aspect ratio of the product cards to be portrait on mobile devices while using the Dawn theme, you can use custom CSS to target only the mobile version of your website. Add the following code to your theme:
1- Go to your Shopify admin and navigate to Online Store > Themes.
aspect-ratio: 3/4; /* Set this to your desired portrait ratio */
}
}
This code will change the aspect ratio of the product cards to portrait (3:4) for screens with a maximum width of 768 pixels (typically mobile devices).
Remember to adjust the .card selector based on the actual class used for the product cards in your theme if necessary. Save and preview your changes to see if it matches your expectations.
If you have other questions, I am willing to answer them more.
I have added the code to base.css but can’t seem to get it to work unfortunately.
I am a bit unsure what you mean by “Remember to adjust the .card selector based on the actual class used for the product cards in your theme if necessary.”?