<?xml version="1.0" encoding="utf-8"?>

CSS background-image property

CSS background-image property Bad Practice
CSS background-image property Best Practice

The image background is largely popular for hero images on websites, image carousels, or article covers. To set an image for a background, we use the background-image property. By default, the image takes the whole element's container, and if it's too small, the browser repeats or tiles the image. The property value should contain a url specifying the image location.

Pro Tip: Even if you specify the image for a background, set a background-color property as a back-up in case the image won't load.

Improve your UX & Product skills with interactive courses that actually work