Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Responsive product page using GRID

accessibility
amoeba25•140
@amoeba25
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


My approach

Picked up another easy looking challenge which did not have a lot of issues. I was going to use grid for this but realised midway that block level elements do the trick with good padding and margin rules. I still need to figure out how to margin and padding is going to work when we are switching view. For this one, I went from desktop to mobile instead of the other way around.

Some questions and notes I had for the community:

  1. Is this approach feasible? I need to figure out how do people work with their margins and padding while designing things.
  2. I'll pick a bit more difficult next project to understand the usage of grid and get better at responsiveness in general.
  3. Need to figure out why my firefox dev console shows a different view compared to when I actually use my phone to see it.
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • MaximilianoDanielGarcia•1,980
    @MaximilianoDanielGarcia
    Posted over 1 year ago

    Hi @amoeba25, great job!

    Consider set a fixed width so that it doesn't wrap depending on the screen resolution, I recommend width: 600px;.

    Also, I've noticed that you aren't using the image for mobile. Here an example that how to use multiple img depending of media queries.

    <picture>
      <source media="(width <= 465px)" srcset="images/image-product-mobile.jpg">
      <img src="iimages/image-product-desktop.jpg" alt="Perfume image">
    </picture>
    

    I hope these are helpful to you.

    Marked as helpful
  • P
    Qendresa Braha•350
    @HiQendresa
    Posted over 1 year ago

    Hi @amoeba25. 👋

    Congratulation on finishing this challenge 🎉 . Remember, we all face challenges when learning something new, and you're doing great!

    I wanted to share a few tips that might make things a bit easier for you. 



    HTML Structure : 


    - Use Semantic Elements: Choose semantic HTML5 elements (like <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>) to convey the meaning of different parts of your page. This improves accessibility and makes your code more readable.

    - Div as a Generic Container:

    • Use a <div> element instead of <section> if the purpose is simply to group content within a card component. <div> is a generic container that doesn't carry any specific semantic meaning, making it versatile for grouping elements.

    - Article or Div for Card Content:

    • If the content inside the card has a more independent or self-contained meaning, you might consider using an <article> or another <div> element for the card content.

    - Consider File Organization:

    • Separate Concerns:
      • If your project is expanding, consider separating your HTML, CSS, and JS into distinct directories. This separation makes it easier to locate and manage files as your project grows.
      • In your project repository are a lot of unneeded files! 


    - Flexbox Tips: 


    Start Simple: Begin with basic layouts to get a feel for how Flexbox works. A row or column layout is a great starting point.

    Master Flex Properties: Focus on understanding properties like flex-direction, justify-content, and align-items. These are the building blocks of Flexbox layouts. Flex Containers vs. Items: Clarify the difference between properties that apply to the container (display: flex;) and those that apply to the items within (flex-grow, flex-shrink, flex-basis).

    The more you use them, the more comfortable you'll become.

    Don't hesitate to use online resources like MDN Web Docs or CSS-Tricks for quick reference and examples.

    Also you can find the answers to your questions here:

    Creating squishy padding and margin that adapt to the viewport

    5 simple tips to making responsive layouts the easy way

    Learn flexbox the easy way

    Happy coding! 🚀

  • Jamila•10
    @potpot89
    Posted over 1 year ago

    Hey there,

    the project seems very well done.

    As already pointed out, use a div instead of a section if the purpose of it is to just be a container.

    I usually use Chrome to develop stuff as the Chrome dev tool is very helpful and well done. There are some differences between the browser and sometimes they can slightly affect how you see things on the web, despite having the same code. On the web, you can find some meta tags that you can use to solve this with the different browsers.

    To learn in depth with grid, I strongly recommend Grid Attack . It only requires your mail and it is free to play. Great way of learning in a fun way.

    As for flexbox, you can try out Flexbox Froggy .

    These 2 games really helped me a lot in working out how to use all properties for a better and most responsive layout for websites. I hope you can find them useful too.

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

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