Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 2 months ago

Product Review Component using Flexbox and Media Query

Gabriel Rodriguez Perez•160
@glrodriperez98
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of how clean and responsive the final layout turned out, especially switching between desktop and mobile views. Getting the image to stack on top for mobile and sit beside the text on larger screens was a rewarding challenge, and I was happy with how well the design stayed consistent across devices.

If I were to do it again, I'd pay even closer attention to accessibility from the start, including better semantic elements and alt text. I’d also consider adding a light hover animation or small transitions to the button to enhance the interactivity.

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

One of the main challenges was vertically centering the card while keeping the attribution text positioned properly on the page. Initially, my layout was causing the attribution to sit awkwardly to the side of the card instead of below it.

I overcame this by restructuring the HTML to wrap both the card and attribution inside a container div, and then using flex-direction: column with align-items: center to stack everything properly. I also used gap to space out the content without needing extra margins. Though I believe I've seen feedback on others projects NOT to use gap...so any advice on the proper usage would be appreciated.

Another challenge was handling the responsive image layout, especially making sure the card image resized nicely and aligned well with the text. I resolved that by using percentage-based widths and media queries to switch flex directions between row and column layouts.

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

I’d love to get feedback on how to make the layout even more scalable and maintainable, especially when dealing with more complex designs or components. Specifically:

  • Are there any best practices for structuring the layout that I could use to make future projects easier to scale?

  • What’s the best way to approach fluid typography and spacing that adjusts more elegantly across breakpoints?

  • Are there accessible or semantic HTML improvements I can make to strengthen the structure further?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • KumaKorin•180
    @KumaKorin
    Posted 2 months ago

    Hello Gabriel! 😊 Great job on completing this project—it looks fantastic! 🌟 Here’s some quick feedback:


    Semantic HTML

    • You've used semantic tags like <main> and <h1>, which is great! Wrapping the .card in an <article> could make it even more meaningful.

    Accessibility

    • Alt text for images is a nice touch! For the cart icon, consider using aria-hidden="true to prevent redundancy with the button text. Adding :focus styles would also improve keyboard navigation.

    Responsiveness

    • Your card adjusts well on smaller screens, and the column layout is clean. However, the heading font size (1rem) could be slightly larger for readability.

    Code Structure

    • The use of CSS variables makes your code maintainable—great job! Grouping related styles (like typography) could improve readability further.

    Design Accuracy

    • Your solution closely matches the design! 🥳 Just double-check spacing and line-heights for any small inconsistencies.

    Overall, this is a strong and polished solution! Keep up the awesome work, Gabriel! 🚀

    Marked as helpful

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub