Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Product Page Preview Challenge

@lank81

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What challenges did you encounter, and how did you overcome them?

I'm still having issues with my media query. I tried to change the image and border radius when shrinking to 768 or less. I wasn't seeing the results I expected. I tried to have ChatGPT and GitHub Co-Pilot look over my work and there were no suggestions to fix my issue.

What specific areas of your project would you like help with?

Media Queries

Community feedback

Adriano 37,770

@AdrianoEscarabote

Posted

Hi Matthew Lancaster, hope you're doing well! I loved how your project turned out, but I’ve got a few suggestions that could be useful:

Using Flexbox or Grid on the body to center elements ensures a more responsive and adaptive layout, fitting different screen sizes seamlessly. It avoids manual calculations and constant adjustments needed with margin, padding, or absolute positioning. These techniques provide more consistent alignment and simplify the code.

flexbox:

body {
    display: flex;
    justify-content: center;
    align-items:  center;
    min-height: 100vh;
}

grid:

body {
    display: grid;
    place-content: center;
    min-height: 100vh;
}

The rest is fantastic.

Hopefully, you'll find it helpful. 👍

Marked as helpful

1
P
Michał 80

@Michal-Majchrzak

Posted

Hey @Matthew 👋, here are some suggestions that may help you with this challenge

  • to change product image based on viewport width you can use picture and source elements inside HTML file. This resource: Responsive Images helped me to implement this in my solution.

  • inside your .container class you can change flex-direction to column when width is less than 768 px so the image would be displayed on top.

  • additionaly inside media query you are using > to apply styles to img element that is direct child of the element with .container class.

.container > img {
      border-top-left-radius: .625rem;
      border-top-right-radius: .625rem;
    }

This rule is not applied because direct children of .container are divs with .column class. You can change this to .container > .column > img then top-left and top-right border radius will be applied to image.

I hope this is helpful, Happy Coding😀

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

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