CSS background-size property - W3Schools
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Searching…
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
The background-size CSS property sets the size of the element's background image. The image can be left to its natural size, stretched, or constrained to fit the available space.
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software ...
In the above example, the contain value of background-size resizes the background image to fit within the div maintaining the aspect ratio of the image. Without using background-size: contain, we will have the followi...
Master CSS background-size property with comprehensive examples of cover, contain, and custom sizing. Learn responsive background techniques with interactive demos.
The background-size is a CSS property which sets the size of the background-image. Read about the values and try examples for yourself.
How it Works The background-size property can be used to specify the size of background images in one of three ways. Designers can choose to either supply one or two lengths, percentages or auto keywords, or use the c...
Explore the 'background-size' CSS property with interactive examples and learn how to control background image dimensions effectively.
Learn about the background-size CSS Property. View description, syntax, values, examples and browser support for the background-size CSS Property.