Search⌘ K

Responsive Background Cover

Explore how to implement a responsive background cover using CSS that scales images to fill containers without distortion. Learn to apply background-size and background-position properties to maintain aspect ratio and centered focus, all within CSS constraints and without altering HTML.

Problem description

You have a <div class="hero"> element meant to display a full-width background image. Write CSS rules so the image covers the entire ...