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

Product Preview Card Component Using Css grids and Flexbox

Ali Sher Khan•260
@AliSherTR
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Jeff Guleserian•500
    @jguleserian
    Posted 11 months ago

    Greetings, Ali

    Thank you for letting me take a look at your solution for the Product Preview Card Component. I like your use of grid to switch the orientation of the two columns and your CSS to switch the hero image.

    Another method, which you probably thought of for the former, would be to use a flex box for the switching of the columns. Likewise, another element to be aware of is the <picture> elements that dynamically changes the image based on media queries as delineated in the HTML. You can take a look here in case you don't already know about this latter technique. Regardless of what you choose, your solutions worked very well.

    I might also point out a couple of things I noticed that would be an easy fix. First, I noticed that in your <img> elements, you have the rel property listed, but without a description of the image. This could lead to issues for screen readers or for other users if the link should happen to break. Something like rel = "A bottle of Gabrielle Essence Eau De Parfum" would be enough to suffice.

    I also noticed that the scaling was off on the entire component. I'm thinking that you did not have access to the Figma file which would have made getting the dimensions of your <div class="product"> easier (it was 60rem, not the 50rem that you have). In fact, you might take a look at the max/min-width settings and whether you need them if you are not making the container responsive and actually take care of the sizing in the media query. Since you are starting with the larger size, in your case 50rem, you could just put that as the width and let the media query do the rest.

    Anyway, the container sizing threw off the other sizes and proportions as well. I encourage you to compare you project with the model they give you in the starting files.

    Other things you might consider:

    1. Filling out the README-template.md, and then renaming it so it is the README.md file. This will help reviews understand your processes and struggles. It will also help you process the work better in your own mind.
    2. Try more semantic HTML, i.e., naming your containers that will have a better logical order. If a screen reader is trying to make sense of your site, I will have structures such as <header> <footer> <section> <article> etc. to help it navigate. It's also easier to others to get a handle on your structure a little more.

    In the end, your solution looks great, and your project ended up being an attractive solution. I just encourage you to make more comparisons to the original, since the exercise is to copy it exactly.

    Thank you again for letting me take a look at your work. If I can be of any help in any way, please let me know.

    Happy coding!

    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