If too few position or repeat values i. Specifying background-color when applying multiple background images applies the color as the final lowest background layer, behind all of the background images. Course Catalog. Training Delivery Methods. Live Online Classes. Private Classes. Self-Paced Training. Enterprise Training.
In this example, three backgrounds are stacked: the Firefox logo, an image of bubbles, and a linear gradient :. As you can see here, the Firefox logo listed first within background-image is on top, directly above the bubbles graphic, followed by the gradient listed last sitting underneath all previous 'images'. Each subsequent sub-property background-repeat and background-position applies to the corresponding backgrounds. So the first listed value for background-repeat applies to the first frontmost background, and so forth.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
The two other possible values for background-size are contain and cover. The contain keyword scales the background image to be as large as possible but both its width and its height must fit inside the content area.
As such, depending on the proportions of the background image and the background positioning area, there may be some areas of the background which are not covered by the background image. The cover keyword scales the background image so that the content area is completely covered by the background image both its width and height are equal to or exceed the content area.
As such, some parts of the background image may not be visible in the background positioning area. The following example illustrates the use of contain and cover :. The background-size property also accepts multiple values for background size using a comma-separated list , when working with multiple backgrounds. The following example has three background images specified, with different background-size value for each image:.
Now we want to have a background image on a website that covers the entire browser window at all times. Then set a fixed and centered background on it. Then adjust its size with the background-size property:. The CSS background-origin property specifies where the background image is positioned. The following example illustrates the background-origin property:.
0コメント