Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

2nd attempt-product-design

Taiwo•40
@fawzab
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


All feedback is welcome

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Anton•515
    @antarya
    Posted almost 3 years ago

    Hi ,

    Great job, it looks good.

    I have a couple of suggestions:

    CSS

    [1. All elements inside .whole have margin-left: 40px. To achieve the same but to have only one style, you can define padding on the .whole element. It will be easier in the future to change it instead of specifying it for each child element.

    /* remove all margin-left: 40px on all child elements and add one padding to parent */
    .whole {
      padding: 17px 40px;
    }
    

    [2. The content inside the Add to Cart button is not aligned vertically; it looks like the fixed height is redundant.

    .whole .fa {
      /* width: 50px; */
      /* height: 100px; */
      margin-right: 20px;
    }
    

    [3. You have fixed width and height which works in this case, but you cannot depend on text length; in real applications, you never know the size of the length, so you need to make your layout adapt to whatever length it will have. You can check it by typing longer text for an item description. Allow elements to grow without fixed width/height, and when you want to restrict, use max-width/max-height or min-width/min-height;

    [4. On smaller screens, e.g. 320px, the page doesn't look like in mock. You might need to use media queries, so it looks good on smaller screens.

    • https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries,
    • https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Responsive/Mobile_first

    And for arranging items, try using flexbox or grid as it is easier to use and has more features.

    • https://css-tricks.com/snippets/css/a-guide-to-flexbox/
    • https://www.frontendmentor.io/resources search for flexbox and grid for useful learning material.

    Using a mobile-first approach and media queries, you will change styles to:

    .container {
      /*
          A
          B
        */
      display: flex;
      flex-direction: column;
    
      /* you can set radius on parent element instead of each child element */
      border-radius: 10px;
      overflow: hidden;
    }
    @media (min-width: 900px) {
      .container {
        /*
            A B
          */
        /* display: flex; */
        flex-direction: row;
      }
    }
    
    • https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Responsive/Mobile_first

    [5. You can set display: block on the image to remove white space under the image. For details, check:

    • https://stackoverflow.com/questions/31444891/mystery-white-space-underneath-image-tag/31445364#31445364

    HTML

    [6. Wrap your card container with the main tag instead of using the main tag as your card parent tag; this would be semantically correct.

    • https://learn-the-web.algonquindesign.ca/topics/html-semantics-cheat-sheet/
    • https://www.w3schools.com/html/html5_semantic_elements.asp

    Let me know if you have questions. I hope this will be helpful.

    Keep up the good work . Cheers!

    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