Design comparison
Solution retrospective
Hi, guys. I've started learning front end development recently and this is my first challenge. It took me a while to complete the challenge, but I've learned a lot.
I have 2 questions and would appreciate if someone could clarify any of them:
-
I've seen some people using a div element as a page wrapper. Is there a special reason for using that instead of using the body element itself ?
-
How could I center an image in a div element so that when the div shrinks horizontally, the image will be cropped from both sides? (mine is being cropped from the right)
Any other advice regarding my code will be much appreciated! Many thanks in advance!
Community feedback
- @ApplePieGiraffePosted over 3 years ago
Hey there, Giovani! π
Congratulations on completing your first Frontend Mentor challenge! π Well done on this one! π Your solution looks good and responds well! π
About your questionsβI don't really see any reason to include an extra wrapper for the content of the page (unless you are using a JS framework or something and that's needed) or you want to do something like limit the maximum width of the content of the page and horizontally center it (which is a common thing to do). π
In addition to adding
object-fit: cover
to the image to ensure that it gets cropped (not squeezed or stretched) when the size of its container changes, maybe you could play around with theobject-position
property to have it remain in the center of the its container, too. Learn more about that property here. πHope that helps. π
Keep coding (and happy coding, too)! π
1@giovanibulianPosted over 3 years agoHey, @ApplePieGiraffe ! Many thanks for the feedback! π I really appreciate it.
Thanks for the answers to my questions as well. I'm taking a look at the
object-fit: cover
andobject-position
properties you've mentioned and I'll try to work that out.Happy coding! π
0
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