From the course: CSS Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

The background property

The background property - CSS Tutorial

From the course: CSS Essential Training

The background property

- [Instructor] Now that we have a variety of selector options to choose from, let's prepare for an upcoming project update and talk about the background property. We've already used this style in a few examples to change the background color of an element, but background is actually shorthand for many more background styles. Let's open a code pen example to see how these properties work. The longhand syntax for setting the background color of the element is background-color. Let's add that style in for images. If it's for presentation only, we can use the background property. If it's part of the content, like the project thumbnails, then it should be added to the HTML with the IMG tag. Otherwise, we can use the background-image property. The value is the URL function value. This is where we add the path to the image within the parentheses using the same rules for linking images we discussed in chapter one. If the…

Contents