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 Add Image in Text Background using HTML and CSS ?
- How to Rotate Container Background Image using CSS ?
- How to stretch and scale background image using CSS?
- How to change the background image using jQuery ?
- JQuery | Setting background-image using CSS property
- CSS | Combine background image with gradient overlay
- 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 | background-size Property
- How to set the div height to auto-adjust to background size?
- 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?
- CSS | Background
- CSS | Hue Background
- How to use SVG Patterns as the background ?
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.