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?
- JQuery | Setting background-image using CSS property
- How to give text or an image transparent background using CSS?
- 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-origin property
- CSS | background-attachment Property
- CSS | background-position Property
- How to set multiple background images using CSS?
- CSS | background-repeat 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.