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

Responsive page using CSS FlexBox

Hawi Girmachew•250
@Hawigirmachew
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


It was my first challenge here in frontend Mentor and it was good. My difficulties in this project were in the responsiveness of my page, can someone review my code and give me feedback?

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • stv10•40
    @stv10
    Posted almost 3 years ago

    Hello Hami! congrats on finishing this challenge.

    Your solution is almost perfecst to me, i'm learning too but here are a few changes i would do.

    1 I don't know if setting body to flex is a good idea, a better choice would be to wrap your content (on this case div 'product'), in a 'container' div and give the flex property to it.

    2 In the smaller screens you forgot to center your divs inside product div, check it out later

    3 Remember using flex means that you will have a father container and childs containers the father is the flex one and it is better if you don't change the size of the father to make the childs smaller. You can quit the flex basis from body and manage the size of product with styles like max-width and max-height and that will allow you to use the align-items property to center your content and not use the padding

  • Harsh Kumar•5,480
    @thisisharsh7
    Posted almost 3 years ago

    Hey Hawi, well done! your solution seems to be fine but there is some improvements which could be made

    1. For aligning the content to the center avoid using padding like here you did .product{ padding:231px 0; } instead you can use this body{min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;} in your code

    2. Avoid margin here in media query at 700px instead you can give .product align-items: center and margin problem can be resolved.

    3.When you use flex you should give align-items and justify-content property to the center so that content perfectly aligned to both the axes

    Hope this answers your query..

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

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