Submitted about 1 year agoA solution to the Product preview card component challenge
RWD Product Card using CSS grid
@Sheepnore

Solution retrospective
What challenges did you encounter, and how did you overcome them?
- Changing img based on device width: Using solves the problem.
- The border-radius not applying on the container: The issue was the img is bigger than the grid container, causing it to overflow. Setting
overflow: hiddenwill clip out the overflowing part of img. - The img is too big for grid container: To shrink it down to fit the container, setting
max-width: 100%height: autoon the img.max-width: 100%ensures that the img cannot be wider than its parent element. After that, settingdisplay: blockwill fill out the empty space in the column where img is in.
Code
Loading...
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Kevin Shie's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord