The background-size property is used to specify the size of the image that is used as a background for an element.
You can specify the size by using any of the following values:
Sets the image to its original size. Some examples of using the auto keywords to specify the size are given as follows:
background-size: auto; background-size: auto auto;
Sets an image of specified size in terms of height and width. Some examples of using the background-size property to specify length parameter of an image are given as follows :
background-size: 15px; background-size: 50px 100px;
Sets the size of an image with respect to the specified height and width of the area in which the image has to be displayed. Some examples of using the percentage parameter to specify the size are given as follows :
background-size: 50%; background-size: 50% auto;
Note - The size of a background image cannot be defined in negative values, but a zero size image is allowed; however, it will not be displayed.
© Copyright 2021. All Rights Reserved.