To fix the issue, avoid using fixed heights for the container. Replace height with min-height to set a minimum size while allowing the container to grow with its content. Additionally, to adjust the background image and prevent it from repeating, use background-size: cover;, which will make the image fit the container size without breaking the layout.