Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

3 column preview card

Stefaniaโ€ข 130

@Goat3ggs

Desktop design screenshot for the 3-column preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello. I tried to make this project, but then I saw the content is cut off at the top when I adjust the screen for the mobile version. Can someone explain me what is wrong in my code cause I can't find the problem. Thank you!

Community feedback

Daniel ๐Ÿ›ธโ€ข 44,230

@danielmrz-dev

Posted

Hello @Goat3ggs!

Your project looks great!

The content is cut off at the top on mobile version because you set place-content: center; to it. This is not a problem for the destktop version, since the card should be in the middle of the page.

You can fix that by adding place-content: center; only for the destktop version. You can use media queries for that. Do this:

  • First, remove place-content: center; from the body.

  • Then add place-content: center; to the body's @media: 600px.

By doing that, it'll only work for the desktop version, and your mobile version won't be cut off anymore.

I have one more suggestion for you:

  • Consider increasing your @media breakpoint. Between 600px and 800px the card gets squeezed. Maybe increase it to 900px or so.

I hope it helps!

Other than that, you did a great job!

Marked as helpful

1

Stefaniaโ€ข 130

@Goat3ggs

Posted

@danielmrz-dev Thank you so much! I wouldn't have figured out the solution in a thousand years. I am at the beginning, so it is not so easy for me to find solutions for the problems I encounter. I fully appreciate your help.

1
Daniel ๐Ÿ›ธโ€ข 44,230

@danielmrz-dev

Posted

@Goat3ggs

That's what we are here for! Help each other ๐Ÿ˜Š I'm glad I could help!

1

@MelvinAguilar

Posted

Hello!

The issue you're experiencing with the content being cut off at the top on mobile screens may be related to the way you've set the height of the html and body elements. While setting height: 100%; is a common practice and even comes by default in some CSS resets, on smaller screens like mobile devices, the content can often exceed 100% of the screen. Also, the place-content: center; is centering the element perfectly within its screen (That's why you will always see the SUVs section in the center.), but to achieve this, the component gets pushed upwards. This is why you may see content cut off at the top.

To address this, consider using min-height: 100vh; instead. This allows the body element to grow in height, adapting to the content. You can also explore using dynamic viewport units for a responsive solution.

I hope you find it useful! ๐Ÿ˜„

Happy coding!

Marked as helpful

0

Stefaniaโ€ข 130

@Goat3ggs

Posted

@MelvinAguilar Yes it is very useful and I appreciate that you had the time to help me. It is a solution that I wouldn't never thought of. Thank you!

1

Please log in to post a comment

Log in with GitHub
Discord logo

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