Follow The New Tutorial updates on WhatsApp, Telegram or YouTube.

CSS background-image Property

The background-image property is used to set an image as a background of an element. By default the image covers the entire element. It sets one or more background images for an element.

By default, a background-image is placed at the top-left corner of an element, and repeated both vertically and horizontally.

The background of an element is the total size of the element, including padding and border (but not the margin).

The background image should be chosen according to text color.

The bad combination of text and background image may be a cause of poor designed and not readable webpage.


background-image: ('url')|none|initial|inherit;

url(‘URL’)– This is the URL of image. To specify more than one image, separate the URLs with a comma.

none-No background image will be displayed. This is default value.

initial– Sets this property to its default value.

inherit– Inherits this property value from its parent element.


<!DOCTYPE html>

        body {
            background-image: url("");
            margin-left: 100px;