CSS background property

CSS background

CSS background property, is a shorthand property. It lets us to use multiple background type CSS properties simultaneously.

CSS background shorthand properties are

  • background-color : It is used to specify the color of the background.
  • background-image : It is used to specify the background images.

  • background-position : It is used to specify the background images position.

  • background-size : It is used to specify the background images size.

  • background-repeat : It is used to specify whether the background images to be repeated or not.

  • background-origin : It is used to specify the positioning area of background images.

  • background-clip : It is used to specify whether the image should be extended or not within an element.

Example

Try Yourself

In the above example values used in background property are,

orange - background-color

url("logo2.png") - background-image

repeat-x - background-repeat

fixed - background-attachment

center - background-position