CSS background-size property
CSS background-size property defines the size of the background image on the background painting area.
background-size : contain | cover | auto | length | percentage
The size of the background image is automatically calculated.
The image is rescaled to the largest size such that both sides of the image fit inside the background painting area while preserving the aspect ratio.
The image is rescaled to the smallest size such that it covers the background painting area completely while preserving the aspect ratio.
We specify a fixed length for the background image size.
It represents the image size as the percentage of the background painting area.
30% means the background image occupies the 30% of the element. And three images can fill the painting area of an element with this size.
It applies to all elements
Was this article helpful?