The background-size property is used to set the background image size using CSS. Use height and width property to set the size of the background image.
background-size: width height;
- If the first value is omitted then the image takes its original width.
- If the second value is omitted then the image takes its original height.
Example 1: This example sets the background-size into width and height.
Example 2: This example sets the background-size into percentage.
- CSS | background-image Property
- How to Rotate Container Background Image using CSS ?
- How to Add Image in Text Background using HTML and CSS ?
- How to change the background image using jQuery ?
- How to stretch and scale background image using CSS?
- How to give text or an image transparent background using CSS?
- How to Create a Wave Image for a Background using HTML and CSS ?
- CSS | Combine background image with gradient overlay
- JQuery | Setting background-image using CSS property
- CSS | background-size Property
- Difference between background and background-color
- Convert an image into grayscale image using HTML/CSS
- How to hide “Image not found” icon when source image is not found?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.