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 change the background image using jQuery ?
- 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
- How to set the SVG background color ?
- p5.js | background() function
- CSS | background-position 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 email@example.com. 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.