-
The
background-size
CSS property sets the size of the element's background image -
The image can be
- left to its natural size
- stretched
- constrained to fit the available space
-
Spaces not covered by a background image are filled with the
background-color
property, and thebackground color
will be visible behind background images that have transparency/translucency -
The
background-size
property is specified in one of the following ways-
Using the keyword values
contain
orcover
-
Using a
width
value only, in which case theheight
defaults toauto
-
Using both a
width
and aheight
value, in which case the first sets thewidth
and the second sets theheight
-
Each value
can be a
length
, apercentage
, orauto
-
Using the keyword values
- To specify the size of multiple background images, separate the value for each one with a comma