CSS3 contains several new background properties,
which allow greater control of the background element.
In this chapter you will learn about the following background properties:
You will also learn how to use multiple background images.
Internet Explorer 9+, Firefox, Chrome, Safari, and Opera support the new background properties.
The background-size property specifies the size of the background image.
Before CSS3, the background image size was determined by the actual size of the image. In CSS3 it is possible to specify the size of the background image, which allows us to re-use background images in different contexts.
You can specify the size in pixels or in percentages. If you specify the size as a percentage, the size is relative to the width and height of the parent element.
Resize a background image:
Stretch the background image to completely fill the content area:
The background-origin property specifies the positioning area of the background images.
The background image can be placed within the content-box, padding-box, or border-box area.
Position the background image within the content-box:
CSS3 Multiple Background Images
CSS3 allows you to use several background images for an element.
Set two background images for the body element:
|background-clip||Specifies the painting area of the background images||3|
|background-origin||Specifies the positioning area of the background images||3|
|background-size||Specifies the size of the background images||3|
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.