CSS contents and browser compatibility

See the CSS Selector Test for tests of and information about CSS3 selectors.

An earlier version of this page has been translated into Brazilian Portuguese.

The contents of my CSS pages and browser compatibility.

Table of Contents

How to trigger them, what the differences are. Contains compatibility table.
Be very, very careful.
A generally reliable method for separating IE from all other browsers.

CSS 2.1 selectors

Specification.

Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 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 Static Yes Yes

Static: the browser doesn’t correctly update the styles of the original element when another element is placed before it.

IE8b2 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 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 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 Incomplete Yes Yes Incomplete Yes Yes Almost
  • IE 5/6 supports both only on links. IE 7/8 supports :hover, but not :active, on all elements.
  • Konqueror removes the :active styles almost immediately.
  • These pseudo-classes are hard to test on the iPhone. Clicking on the test link gives it the hover styles; until you click on another link. (This is consistent with the mouseover/out implementation of the iPhone.) The active styles aren’t supported.
An element that is the first child of its parent No Static Almost Static Yes Static Yes Static 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.

Form fields that receive user focus No Yes Yes Yes Buggy Yes Yes Yes
  • Safari iPhone doesn’t put the focus on the field. Once you’ve clicked on the field (and it has gotten the correct :focus styles) you have to click it again, or your typed text won’t appear. This is caused by the width change.
Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7

CSS 2.1 declarations

Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7
for :before/:after No Yes Almost Yes Almost Almost Almost Almost
  • Only IE8, FF3+ and Konqueror support the none value.
  • Konqueror has a counter issue.
No Yes Yes Yes Yes Yes Yes

To assign counters to headings or other elements.

Change cursor style Yes Yes Yes Untestable Yes Yes Yes

Microsoft values don’t count for overall browser compatibility.

  • An iPhone does not have a cursor.
Incomplete Almost Yes Incomplete Yes Yes Yes Yes Yes

Compatibility depends only on the values block, inline, none, inline-block, and list-item.

Types, image, position Incomplete 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 min-height on TD’s only.

Declaration IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7
A sort of border, but different No Yes Yes Yes Yes Yes Yes
Incorrect Yes Yes Yes Yes Yes Yes
  • IE 5/6 doesn’t implement overflow: visible correctly.
Incomplete Almost Buggy Yes Yes Incomplete Yes Yes Yes

IE 5/6 and Safari iPhone don’t support position: fixed

  • IE7 has a strange bug; see page.
  • IE8b2 hides the green layer when you select absolute or fixed.
Incomplete Yes Yes Incomplete Incomplete Incomplete Incomplete

See page for detailed compatibility.

empty-cells, border-collapse, border-spacing, table-layout, caption-side Incomplete Yes Yes Yes Yes Yes Yes

See page for detailed compatibility.

To remove text wrapping or to make an element behave like a pre Incomplete Yes Incomplete Yes Yes Yes Yes Yes

See page for detailed compatibility.

Declaration IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7

CSS 3 selectors

Specifications.

Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 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
 
The first line or first letter of an element Yes Yes Almost Almost Almost Almost
  • Safari, Chrome and Konqueror add an extra 'T' when you do the dynamic test.
  • Opera leaves out the 'T' of the second and subsequent sentences when you do the dynamic test.
Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 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 Incomplete Yes
  • Opera doesn’t react to the Back and Forward buttons: the element doesn’t apply or remove the pseudo-class at all.
For enabled, disabled, or checked form fields. No Yes Yes Yes Yes Yes
Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7
Empty elements No Static Yes Static Yes Incomplete Yes Yes Static

Static: The browser does not update the styles when content is added to an initially empty <div>.

  • Safari iPhone correctly removes the :empty styles when content is added but does not re-apply them when the content is removed.
An element that is the last child of its parent No Static Yes No Yes Static 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 Dynamic bug Yes Dynamic bug Static Yes
  • Opera always adds the correct styles to newly generated elements, but it doesn’t remove the styles when necessary. In practice, that means that once an element gets an nth-child style it never loses it.

  • Chrome and Safari 3.1 have a bug in the dynamic test, but it’s not as clear-cut as the Opera one. Basically they seem to get confused by the (admittedly non-standard) paragraphs in the list.
Text selected by the user. No -moz- Yes Untestable 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 Static Yes No

Safari assigns the styles statically on page-load and doesn’t update them.

Declaration IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7

CSS 3 declarations

Selector IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7
on elements other than body Incorrect Incomplete Incomplete Incomplete Minimal Incomplete Incomplete Incorrect

scroll and fixed are CSS 2 values, but local is a CSS 3 value. It’s vital, so I’m testing CSS 3 compatibility here.

  • In IE7 and lower and Konqueror scroll means local.
  • Safari iPhone supports only scroll.
  • No browser supports local.
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 -moz-box-sizing and supports an additional value. Safari 3.1+ -webkit-box-sizing.

No browser supports box-sizing in combination with min- or max- width or height.

  • Safari iPhone gives the border-box a smaller font size. This is a bug.
Divide a box into several columns. No -moz- -webkit- -webkit- No No
 
Declaration IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7
on any element, without reference to the :before/:after pseudo-elements. No No Incomplete Incomplete Yes Yes
  • Safari and Chrome support content for images, but not for text.
filter -ms-filter Yes Yes Yes Yes No

Standard syntax; Microsoft syntax for IE5-7, and Microsoft syntax for IE8. See page for details.

Allow the user to resize an element. No No Yes Incomplete No Incomplete No No
  • Safari 3.1 and Chrome don’t allow you to resize the element to less than its original width, something that Safari 3.0 does allow.
Shows ellipsis characters when a text flows outside its box. No Yes No No Yes Yes -o- Buggy

This property only makes sense when a box has white-space: nowrap and an overflow other than visible.

  • Konqueror doesn’t show the ellipsis characters.
Create a text-shadow. No No Yes Yes No Yes Yes
 
Declaration IE 5.5 IE 6 IE 7 pure IE8b2 as IE7 IE8b2 as IE8 FF 2 FF 3.0 FF 3.1b Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 0.3 Opera 9.51 Opera 9.62 Konqueror 3.5.7

Other test pages

These test pages don’t quite fit in the table above, or their browser compatibility is too slight:

  1. Clearing floats without clear: both.
  2. Scrollbar colours (MS extension).
  3. Backgrounds; a complete test of the CSS3 spec (nothing’s supported yet, except background-size with -webkit- and -o-).
  4. Grids (CSS3 advanced layout); not supported yet.