Responsive Landing Page - HTML CSS Grid

Solution retrospective
I had issues with the hero image so I asked Chat-GPT and this code fixed my issues.
.overflow-wrapper {
overflow-x: hidden;
position: relative;
}
serves two main purposes when dealing with a hero image that has negative margins:
-
Prevents Horizontal Scrollbars: By setting
overflow-x: hidden, it hides any horizontal overflow content that might otherwise extend beyond the viewport. Negative margins on the hero image can push content outside the normal bounds of the page, which could cause unwanted horizontal scrollbars. This rule ensures that any content extending outside the viewport horizontally is clipped, avoiding those scrollbars. -
Maintains Positioning Context: By setting
position: relative, you ensure that the.overflow-wrappercreates a new containing block for absolutely positioned elements inside it (such as the hero image, if needed). This keeps the positioning of child elements relative to this wrapper, which helps prevent layout shifts or unexpected behavior caused by the negative margins of the hero image.
Together, these properties ensure that the layout remains visually contained without any unwanted overflow or positioning issues, making the design more robust and clean.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on E. Marshall's solution.
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