background-size & position Playground

Mrs. Yanti’s signboard in Mr. Karim’s frame: set background-size, -position and -repeat, the browser paints the image and again faintly outside the frame, so…

Why it matters

Almost every hero, banner and card uses cover or contain. Pick wrong and the image is squashed, repeats on its own, or loses its important part. And a background is decoration: a meaningful image needs an <img> with alt.

The key idea

cover takes the larger scale, contain the smaller

Common mistakes

Try it in this playground