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

Responsive card with Flexbox

Brendon 70

@bcrave

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


This challenge was similar to the Results Summary challenge, but I took a slightly different approach with it. Firstly, I decided to wrap both main div's (the top/left image and bottom/right text) in a single div called content, and add the appropriate padding to the whole div. This made it easier line up child elements and make sure the padding was consistent for the whole component, but it did mean that there was white space around the image, contrary to the design. So, I added negative margin to the image on the top and sides to make it flush with the outer div. This is probably a common technique and quite obvious to more experienced developers, but I'm proud of myself for coming up with it :)

One additional note about this approach is that it made it very easy to adjust the component into its desktop layout, but it I was not able to make it a 1-to-1 copy of the design, which has the image taking up 50% of the entire component. I probably could have gotten it there by removing the padding and margin inside my @media query and then add the padding to the right div, but I honestly like the 40/60 split between the image and the text content, so I kept it.

Community feedback

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