Web4College

CSS background-image property

src

Description

CSS background-image property adds an image as the background of an element. More than one images can also be used (subsequently lying over each other) as the background with the first one on top and the last one at the bottom.


background-color should also be used to preserve the contrast between the image layer and other content when the image is not available.

Syntax

background-image : none | url(), url(),...

Property values

noneDefault

It adds a new layer but does not add any image.

background-image: none;
Try it

url()

This value represents the address of an image that is used as the background of an element.

background-image: url(img/web4college.png);
Try it

url(), url()

These two URLs represent the address of two different images with the first one on top and the second one at the bottom.

background-image: url(img/web4college.png), url(img/background.jpg);
Try it

Applicable to

It applies to all elements