Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Background Shorthand | Сolors and Background
Introduction to CSS Part II
course content

Course Content

Introduction to CSS Part II

Introduction to CSS Part II

1. Text Styles
2. Сolors and Background
3. Layouts

bookBackground Shorthand

The background shorthand property in CSS allows you to set all background properties in one place. This can be helpful when you want to set multiple background properties and don't want to write out each one individually. Here is the syntax for doing that:

Each value in brackets is optional, and you can include as many or as few of them as you need. Here is an example of the background property in use:

You can also set individual background properties using the background shorthand property. For example:

This sets the background color to white and the background image to "my-image.jpg", but leaves the other background properties unset.

It's important to note that the order of the values in the background shorthand property matters. The first value is the background-color, the second value is the background-image, and the rest of the values are applied to the remaining background properties in the order listed above.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
We're sorry to hear that something went wrong. What happened?
some-alt