VOOZH about

URL: https://www.geeksforgeeks.org/css/css-background-image-property/

⇱ CSS background-image Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS background-image Property

Last Updated : 11 Jul, 2025

The background-image property allows you to set one or more background images for an element. It allows you to specify the image URL and combine it with other background properties to control its position, size, repeat behavior, and more, enhancing the visual design of web pages.

Syntax

element_selector {
 background-image: url('image_url')| none | initial | inherit;
}

Property Values

Values

Description

url('url')

This specifies the URL of the image. To specify the URL of more than one image then separate the URLs using a comma.

none

This is the default case where no image can be displayed.

initial

It is used to set the property to its default value.

inherit

It inherits the property from its parent element.

The background-image property can also be used with the following values:

Values

Descriptions

linear-gradient()

It is used to set the linear-gradient background-image that is defined at least 2 color from top to bottom.

radial-gradient()

It is used to set the radial-gradient background-image that is defined at least 2 color from center to edge.

Basic Example

This example illustrates the background-image property by setting the url value as url.

Output:

👁 background-image-basic-example
Basic Example

CSS background-image Property Examples

Example 1: Background-image example with background position center and no repeat.

Output:

👁 background-image-property-example-1
CSS background-image Property Example

Example 2: Background-image example with background position center, no repeat and cover.

Output:

👁 background-image-property-example-2
CSS background-image Property Example

Example 3: Background Image with none, This example illustrates the background-image property by setting the url value as none.

Output:

👁 background-image-property-example-3
CSS background-image Property Example

Example 4: Background-image property by setting the url value as initial.

Output:

👁 background-image-property-example-4
CSS background-image Property Example

Supported Browsers

The browser supported by background-image Property are listed below: 

Comment