课程: CSS Essential Training

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

The background property

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…

内容