Design comparison
Solution retrospective
Which areas of your code are you unsure of?
After using CSS-grid, I always find myself having to insert large top margins on content div for mobile media, or else top contents are always cut off. Is there any solution other than adding a margin? I am sure, I am missing something. Appreciate any help, I can* get! *Thanks, *
Community feedback
- @Zy8712Posted 12 months ago
Your site looks great! To answer your question: The reason your box gets cut off from the top in mobile layouts maybe due to the fact that the component is taller in mobile layout, combined with the fact that you positioned your component using
position: absolute
.Here is what you should change with regards to your code:
- make your body:
width: 100vw
andheight: 100vh
- center your content using either
flexbox
orgridbox
. In my opinion, this is better than usingposition: absolute
to center the box.position: absolute
is very useful, but I feel that it should only be used on smaller pieces of your website not the main content - to center with flexbox you can do something like this:
body{ display: flex; flex-direction: column; justify-content: center; align-items: center; }
- last thing, is that you you should use an unorder list for the "Why Us" box to list out the items instead of using line breaks. This can be done using something like this:
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
Hope you find this feedback useful 👍
Marked as helpful1 - make your body:
Please log in to post a comment
Log in with GitHubJoin 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