CSS Background Image

CSS Background Image


Background-Image 

The background-image property is used to specify a background image to be applied to all matched elements.

By default, this image is tiled to cover the entire element, excluding the margin. 

Syntax - 

We can apply background image using the following syntax - 

  1. background keyword,
  2. With hyphen,
  3. And image keyword then
  4. Colon
  5. Now setting url of image inside parentheses of url() function

background-mage : url(image.png)

Now we will see Examples - 

Example 1 -

Output - 

Example 2 -  

We can also add image as the background of paragraph as well

Output -