CSS background-size Property


The background-size property specifies the size of the background images.

There are four different syntaxes you can use with this property: the keyword syntax ("auto", "cover" and "contain"), the one-value syntax (sets the width of the image (height becomes "auto"), the two-value syntax (first value: width of the image, second value: height), and the multiple background syntax (separated with comma).

Syntax

The syntax of the property is given with:

background-size: 
length | percentage | auto | cover | contain | initial | inherit

Example -