This page tests the various declarations of the CSS3 Backgrounds and Borders module.
I left the default values out of this table; they’ve been supported forever.
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 pr3 | FF 3.0 | FF 3.5 | FF 3.6 | FF 4b1 | Saf 4.0 Win | Saf 5.0 Win | Chrome 4 | Chrome 5 | Opera 10.10 | Opera 10.53 | Opera 10.60 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Multiple background images
|
No | Yes | No | Yes | Yes | Yes | Yes | ||||||||||||
|
background-attachment: fixed
|
No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
|
background-attachment: local
|
No | Yes | No | No | Yes | Yes | No | Yes | |||||||||||
|
background-repeat: repeat, repeat-x, repeat-y, no-repeat
The traditional values
|
Yes | Yes | Yes | Yes | Yes | ||||||||||||||
|
background-repeat: space
|
No | Yes | No | No | Incor |
Incor |
No | Yes | |||||||||||
|
|||||||||||||||||||
|
background-repeat: round
|
No | Yes | No | No | Incor |
Incor |
No | Yes | |||||||||||
|
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 pr3 | FF 3.0 | FF 3.5 | FF 3.6 | FF 4b1 | Saf 4.0 Win | Saf 5.0 Win | Chrome 4 | Chrome 5 | Opera 10.10 | Opera 10.53 | Opera 10.60 | |||
|
background-clip: padding-box
|
No | Yes | No | Yes | -webkit- | Yes | Yes | No | Buggy | Yes | |||||||||
|
|||||||||||||||||||
|
background-clip: content-box
|
No | Yes | No | Yes | -webkit- | -webkit- | No | Buggy | |||||||||||
|
|||||||||||||||||||
|
background-origin: border-box
|
No | Yes | No | Yes | -webkit- | Yes | Yes | No | Yes | ||||||||||
|
background-origin: content-box
|
No | Yes | No | Yes | -webkit- | Yes | Yes | No | Yes | ||||||||||
|
background-size: [length]
|
No | Yes | No | -moz- | Yes | -webkit- | Yes | Yes | -o- | Yes | |||||||||
|
background-size: [percentage]
|
No | Yes | No | -moz- | Yes | -webkit- | Yes | Yes | -o- | Yes | |||||||||
|
background-size: contain
|
No | Yes | No | -moz- | Yes | No | Yes | Yes | No | Yes | |||||||||
|
background-size: cover
|
No | Yes | No | -moz- | Yes | No | Yes | Yes | No | Yes | |||||||||
|
border-image
|
No | No | -moz- | -webkit- | -webkit- | No | Yes | ||||||||||||
There’s a difference between Chrome Windows and all other browsers, including Chrome Mac. I’m not taking sides right now, although deep in my heart I believe Chrome Windows is right. |
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 pr3 | FF 3.0 | FF 3.5 | FF 3.6 | FF 4b1 | Saf 4.0 Win | Saf 5.0 Win | Chrome 4 | Chrome 5 | Opera 10.10 | Opera 10.53 | Opera 10.60 | |||
Assigning more than one background image to an element.
div.multiple {
background-image: url(../pix/logo_quirksmode.gif), url(../pix/logo_quirksmode_inverted.gif);
background-repeat: repeat-y;
background-position: top left, top right;
width: 385px;
height: 100px;
border: 1px solid #000000;
}
All properties can have several values separated by commas. If a property has one value it counts
for all background images (repeat-y in the example).
This is the example element we're going to use for the next series of tests:
Text to show where the content area starts
It has the following styles; the relevant background-* will be added inline:
div.test {
background-image: url(/pix/logo_quirksmode.gif);
border: 5px solid transparent;
padding: 10px;
width: 400px;
height: 52px;
overflow: auto;
color: #999999;
margin: 5px 0;
}
How is the background image attached to its element? Does it scroll with the element, the document, or not at all?
The background image scrolls with the document. And no, the name of this value has never made any sense, but it seems we’re stuck with it.
Scrollable
Background is fixed relative to the entire window. The element merely serves as a viewport through which you look at the background image.
In order to see the fixed background in action, scroll the main window slowly.
Scrollable
The background scrolls with the element.
Scrollable
How does the background repeat? Horizontally, vertically, not at all, or does it try to cover the box with a whole number of iterations?
The image repeats unchecked.
The image repeats only horizontally.
The image repeats only vertically.
The image does not repeat.
The image repeats, but only as many times as it fits the box completely After that, the repeats are spaced evenly across the box.
Normal
-moz-
-webkit-
-o-
The image repeats, but if it does not fit the box a whole number of times, it is reduced in size until it does.
Normal
-moz-
-webkit-
-o-
Which area does the background image fill? The padding box, the content box, or the border box? Remove border for a good idea of what’s going on.
The background fills the border box.
Normal
-moz-
-webkit-
-o-
The background fills the padding box.
Normal
-moz-
-webkit-
-o-
The background fills the content box.
Normal
-moz-
-webkit-
-o-
Where does the background image originate? In the padding box, the content box, or the border box?
The background originates in the padding box.
Normal
-moz-
-webkit-
-o-
The background originates in the border box.
Normal
-moz-
-webkit-
-o-
The background originates in the content box.
Normal
-moz-
-webkit-
-o-
What is the size of the background image? You can specify it in pixels, percentages, or scale it to fit the box.
The background image is sized normally.
Normal
-moz-
-webkit-
-o-
The background image’s size is determined by this property (50px 20px in the example).
Normal
-moz-
-webkit-
-o-
The background images’s size is determined by this property (50% 10% in the example).
Effectively, this allows you to state how many times the background image is shown, though resizing will occur.
Normal
-moz-
-webkit-
-o-
The image is scaled to the largest size that allows it to fit in the box, while retaining proper aspect ratio.
Normal
-moz-
-webkit-
-o-
The image is scaled to the largest size that allows it to cover the box completely, while retaining proper aspect ratio.
Normal
-moz-
-webkit-
-o-
Using an image for the border.
Normal
-moz-
-webkit-
-o-
-ms-
There’s a difference between Chrome Windows on the one hand, and all other browsers, including Chrome Mac, on the other. That would usually mean that Chrome Windows is wrong and the others are right, but I think its take on this example is the correct one. So I’m undecided.