Last major update on 28 March 2009.
See the CSS Selector Test for tests of and information about CSS3 selectors.
Earlier versions of this page has been translated into Brazilian Portuguese and Romanian.
The contents of my CSS pages and browser compatibility.
| Quirks and Strict mode | How to trigger them, what the differences are. Contains compatibility table. |
| CSS Hacks | Be very, very careful. |
| Conditional comments | A generally reliable method for separating IE from all other browsers. |
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Selects all elements | Yes | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| Selects an element that is a child of another element | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Selects an element that is a next sibling of another element | No | Static | Almost | Static | Yes | Static | Yes | Static | Yes | Yes | Yes | ||||||||
|
Static: the browser doesn’t correctly update the styles of the original element when another element is placed before it. IE8 as IE8 updates correctly, but only after you remove the focus from the test link. |
|||||||||||||||||||
| Selects an element with a certain attribute | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Whether an element can support two or more class names | Buggy | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| To generate content before and after an element | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| An element in a hovered (mouseover) or active (mousedown) state. | Minimal | Incom |
Yes | Yes | Yes | Yes | Yes | Almost | |||||||||||
|
|||||||||||||||||||
| An element that is the first child of its parent | No | Static | Almost | Static | Yes | Static | Yes | Yes | Yes | Yes | |||||||||
|
IE7, Firefox 2 and Safari don’t update the styles when elements are added dynamically. IE8b2 does, but only after you remove the focus from the test link. |
|||||||||||||||||||
| The first line or first letter of an element | Yes | Yes | Almost | Almost | Almost | Almost | |||||||||||||
|
|||||||||||||||||||
| Form fields that receive user focus | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
|
|
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
for :before/:after
|
No | Yes | Almost | Yes | Almost | Almost | Almost | Almost | |||||||||||
|
|||||||||||||||||||
| No | Yes | Yes | Yes | Yes | Yes | Yes | |||||||||||||
To assign counters to headings or other elements. |
|||||||||||||||||||
| Change cursor style | Yes | Yes | Yes | Yes | Yes | Yes | |||||||||||||
Microsoft values don’t count for overall browser compatibility. |
|||||||||||||||||||
| Incom |
Yes | Incom |
Almost | Incom |
Almost | Incom |
Almost | Yes | Almost | ||||||||||
The compact value is ignored. Incomplete: lacks 2 or more values; almost: lacks 1 value. |
|||||||||||||||||||
| Types, image, position | Incom |
Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
IE7- doesn’t support a few types. The test page also contains CSS 3 values. |
|||||||||||||||||||
| No | Minimal | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
IE 6 supports |
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| A sort of border, but different | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Incor |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||||||
|
|||||||||||||||||||
| Incom |
Almost | Yes | Yes | Almost | Almost | Yes | Yes | ||||||||||||
IE 5/6 don’t support position: fixed
|
|||||||||||||||||||
| Incom |
Yes | Yes | Almost | Almost | Almost | Almost | |||||||||||||
See page for details. |
|||||||||||||||||||
empty-cells,
border-collapse,
border-spacing,
table-layout,
caption-side
|
Incom |
Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
See page for detailed compatibility. |
|||||||||||||||||||
| To remove text wrapping or to make an element behave like a pre | Incom |
Yes | Incom |
Yes | Yes | Yes | Yes | Yes | |||||||||||
See page for detailed compatibility. |
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Selects an element that is a general next sibling of another element | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Selects an element with an attribute whose value starts with, ends with, or contains a certain string. | No | Yes | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| Negation of a selector | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| The root element, or initial containing block. | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
Element that is a target of a hash (page.html#testHash)
|
No | Yes | Yes | Yes | Incom |
Yes | |||||||||||||
|
|||||||||||||||||||
| For enabled, disabled, or checked form fields. | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| Empty elements | No | Static | Yes | Static | Yes | Yes | Yes | Static | |||||||||||
|
Static: The browser does not update the styles when content
is added to an initially empty
|
|||||||||||||||||||
| An element that is the last child of its parent | No | Static | Yes | No | Yes | Yes | Yes | Yes | |||||||||||
|
Static: The browser does not update the styles when elements are added dynamically. |
|||||||||||||||||||
| An element that is the only child of its parent | No | Static | Yes | No | Yes | Yes | Yes | Yes | |||||||||||
|
Firefox 2 doesn’t update the styles when elements are added dynamically. |
|||||||||||||||||||
| Select elements according to a formula | No | No | Yes | No | Incor |
Incor |
Incor |
Yes | |||||||||||
|
|||||||||||||||||||
| Select elements according to a formula | No | No | Yes | No | Yes | Yes | Incor |
Yes | |||||||||||
|
|||||||||||||||||||
| Text selected by the user. | No | -moz- | Yes | Yes | Yes | Yes | |||||||||||||
| Special Mozilla syntax. | |||||||||||||||||||
| Allows you to define blocks of styles that only take effect on certain monitor sizes. | No | No | Yes | Static | Yes | Static | Yes | Yes | No | ||||||||||
|
Safari assigns the styles statically on page-load and doesn’t update them. |
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| on elements other than body | Incor |
Incom |
Incom |
Incom |
Incom |
Incom |
Incor |
||||||||||||
|
|||||||||||||||||||
| How to define more than one background image on an element | No | No | Yes | Yes | No | Yes | |||||||||||||
| No | Yes | -moz- | Yes | -webkit- | -webkit- | Yes | Yes | ||||||||||||
Mozilla requires No browser supports
|
|||||||||||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
on any element, without reference to the :before/:after
pseudo-elements.
|
No | No | Incom |
Incom |
Yes | Yes | |||||||||||||
|
|||||||||||||||||||
| filter | Yes | Yes | Yes | Yes | No | ||||||||||||||
Standard syntax; Microsoft syntax. |
|||||||||||||||||||
| Allow the user to resize an element. | No | No | Yes | Incom |
Incom |
No | No | ||||||||||||
|
|||||||||||||||||||
| Shows ellipsis characters when a text flows outside its box. | No | Yes | No | Yes | Yes | -o- | Buggy | ||||||||||||
This property only makes sense when a box has
|
|||||||||||||||||||
| Create a text-shadow. | No | No | Yes | Yes | No | Yes | Yes | Yes | |||||||||||
| Selector | IE 5.5 | IE 6 | IE 7 | IE8 as IE7 | IE8 as IE8 | FF 2 | FF 3.0 | FF 3.1b | Saf 3.0 Win | Saf 3.1 Win | Saf 4.0b Win | Chrome 1 | Chrome 2 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 | |||
These test pages don’t quite fit in the table above, or their browser compatibility is too slight:
clear: both.background-size with -webkit- and -o-).