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 stretch and scale background image using CSS?
- How to give text or an image transparent background using CSS?
- 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
- CSS | Background
- p5.js | background() function
- CSS | background-position Property
- CSS | background-attachment Property
- CSS | background-color Property
- CSS | background-repeat Property
- CSS | background-origin property
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.