Design comparison
Solution retrospective
What are the best practices for setting the height for the main div element where all the components exist?
Community feedback
- @subu-vPosted over 2 years ago
hi, do not manually give height to your main element, let the elements inside your main element determine the height automatically.
for example, the img has a height to it. Vertical margins and vertical paddings(top and bottom) you set for the elements inside the main element. so is line-height and font-sizes etc these are the one of the few things when combined determine the height of the main element.
Try this in your dev tools in the browser, reduce the vertical margins or padding in your project, the whole component height will be reduced
Marked as helpful0
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