HTML CSS examples for CSS Property:background-image
The background-image CSS property sets the element background image.
The following table summarizes background-image property.
Item | Value |
---|---|
Default value: | none |
Applies to: | All elements |
Inherited: | No |
Animatable: | No. |
The syntax of the property is as follows:
background-image: url | none | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
url | background image location url. |
none | Default value. If specified, no background image will be displayed. |
initial | Sets this property to its default value. |
inherit | takes the value of its parent element background-image property. |
The example below shows the background-image property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS background-image property</title> <style type="text/css"> body {<!-- w ww . j a v a 2 s . c o m--> background-image: url("https://www.java2s.com/style/demo/Opera.png"); } </style> </head> <body> <h1>This a heading</h1> <p>This is a paragraph.</p> </body> </html>