Design comparison
Solution retrospective
I found it difficult to determine what width to set for both the container element and the main content element. How would you recommend determing what width to use for each of these elements?
What is best practice for adding a margin around the main content, taking into account the default margins of the html element?
Community feedback
- @shaik-aaronPosted about 1 year ago
Hey! Great work on completing this challenge!
Regarding what width to use can be a difficult thing especially when you don't have the exact width given to you, so from my experience it just comes with practice!
And one thing about default margins is it's always good practice to reset them so they don't interfere with the margin specified in the design, like so:
* { margin: 0; padding: 0; box-sizing: border-box; }
The third line is to make sure that the padding are included as a part of the element's width and height, to prevent layout issues.
Hope this helps!
Marked as helpful1 - @EDGARTOYINPosted about 1 year ago
Great job!
1-. I would suggest not worrying too much about it right now. If you don't have a pro membership, you will never be 100% sure if your design is the same size. But don't be discouraged; with practice, you will find yourself getting used to it and having fun trying to make the design as accurate as possible.
2.-This one is tricky because you will learn that there are many ways to achieve the same result using different techniques. Instead of thinking, "What's the best practice?" you could choose to search for a simpler and less stressful way to solve a problem.
The next time you want to center any element in the middle, you could use these properties in the body element if you want to see something cool:
body { display: grid; place-items: center; min-height: 100vh; }
happy coding!
Marked as helpful1
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