Web Design & Development Guide

conceptualization, planning, modeling, and execution of electronic media delivery via internet in the form of markup language suitable for interpretation by web browser and display as graphical user interface

Comparison of layout engines (CSS)

The following tables compare CSS compatibility and support for a number of layout engines. Please see the individual products' articles for further information. This article is not all-inclusive or necessarily up-to-date. Unless otherwise specified in footnotes, comparisons are based on the stable versions without any add-ons, extensions or external programs.

Engine Nomenclature

  • Trident is the layout engine used in Internet Explorer for Windows.
    Tasman is used in Internet Explorer for Macintosh.
    Gecko in all Mozilla software.
    WebCore provides the HTML layout engine for Mac OS X.
    KHTML for KDE.
    Presto for Opera.
    iCab is a browser for the Mac.

Meaning of Values

"Yes" indicates that the current version of the browser fully supports this property when valid values are used. "No" indicates that this property is completely ignored. "Partial" indicates that the property is understood, but that not all values are supported. Supported values are implemented correctly. "Buggy" indicates that the property is understood, but that it is not implemented correctly in all cases. "Dangerous" indicates that the property is understood, but that deleterious behaviour results. Version numbers, where known, are provided to indicate when support for this feature was added. If support was added in a publicly available unofficial release (such as an alpha or beta version), a red background is used. Proprietary properties are not included.

General overview

See the article Cascading Style Sheets for more information on the different versions of CSS. This table doesn't reference CSS2.0, as CSS2.1 was intended to replace it by correcting or removing a few errors and features rejected by the CSS community. Most of the removed CSS2 features will be made obsolete by CSS3.

  Trident Tasman Gecko WebCore KHTML Presto iCab
CSS1 6.0 0 1.0 85 Yes 7.0 Yes
CSS2.1 Partial Partial Mostly Mostly Mostly 9.0 Mostly
CSS3 No No Slight Slight Slight Slight Slight

Grammar and rules

  Trident Tasman Gecko WebCore KHTML Presto iCab
CSS2 important Weight increasing 7.0 0 1.0 85 Yes 7.0 Yes
/*Comment*/ Comments 3.0 0 1.0 85 Yes 7.0 Yes
@import Import stylesheet 4.0 0 1.0 Yes Yes 7.0 Yes
@charset Character set 5.5  ? 1.0 0 No 7.0 Yes
@media Media-specific rules 5.5 0.9 1.0 Yes Yes 7.0 3.0
@page For paged media 5.5 No No No No 7.0 No
CSS3 @namespace Namespace declaration No No 1.0 Yes Yes 8.0 No
@font-face Define font 5.5 No No No No No No

Trident grammar and rule notes

  1. @font-face ? Only supports Embedded OpenType (.eot) font format, does not understand the format() identifier.
  2. !important ? !important doesn't override rules defined later in the same declaration block prior to IE7.

Tasman grammar and rule notes

  1. @font-face ? Versions 5.16 and 5.17 will download fonts specified but not use them. 5.23 no longer downloads the font.

Presto grammar and rule notes

  1. @import ? Whilst Gecko, WebCore and iCab download all media stylesheets immediately, Opera only downloads handheld, print, projection and screen media, as well as speech if "voice" feature is enabled and tv, on tv devices. Text browser emulation mode is only a user stylesheet, so it does not switch to tty media type. This is consistent with older text browsers, which do not respect any CSS.

Selectors

  Trident Tasman Gecko WebCore KHTML Presto iCab
Element selectors
CSS2 * Universal 7.0 0 1.0 85 Yes 7.0 3.0
E Element 4.0 0 1.0 85 Yes 7.0 Yes
E.class Class 7.0 Buggy 1.0 85 Yes 7.0 Yes
E#id ID 4.0 0 1.0 85 Yes 7.0 Yes
CSS3 E Namespaced No No 1.0 No Yes 8.0 No
Relationship selectors
CSS2 E F Descendant 4.0 0 1.0 85 Yes 7.0 Yes
E > F Child 7.0 0 1.0 85 Yes 7.0 3.0
E + F Direct adjacent 7.0 0 1.0 85 Yes 7.0 3.0
CSS3 E ~ F Indirect adjacent 7.0 0.9 1.7 412 3.3.2 9.0 3.0
Attribute selectors
CSS2 E[attr] Has 7.0 0.9 1.0 85 Yes 7.0 3.0
E[attr="value"] Equals 7.0 0.9 1.0 Yes Yes 7.0 3.0
E[attr~="value"] Contains (space-separated) 7.0 0.9 1.0 Yes Yes 7.0 3.0
E[attr|="value"] Contains (hyphen-separated) 7.0 0.9 1.0 Yes Yes 7.0 3.0
CSS3 E[attr^="value"] Begins with 7.0 No 1.0 Yes 3.4 8.02 3.0
E[attr$="value"] Ends with 7.0 No 1.0 Yes 3.4 9.0 3.0
E[attr*="value"] Contains substring 7.0 No 1.0 Yes 3.4 9.0 3.0
E[ns|attr] Namespaced No No 1.0 No 3.4 9.0 No
Pseudo-classes
CSS2 E:link Unvisited hyperlink 3.0 0 1.0 85 Yes 7.0 Yes
E:visited Visited hyperlink 3.0 0 1.0 85 Yes 7.0 Yes
E:active Active Partial 0 1.0 85 Yes 7.0 Yes
E:hover Mouseover 7.0 0.9 1.0 419.3 Yes 7.0 3.0
E:focus Focused No 0 1.0 Yes Yes 7.0 Yes
E:first-child First child 7.0 0 1.0 85 Yes 7.0 3.0
E:lang() Language No 0 1.2 522 3.4 7.5 3.0
CSS3 E:root Root No 0.1 1.0 85 3.4 9.5 No
E:first-of-type First child of type No 0.9 No 522 3.4 9.5 No
E:last-child Last child No 0.9 1.0 Dangerous 3.4 9.5 No
E:last-of-type Last child of type No 0.9 No Dangerous 3.4 9.5 No
E:only-child Only child No 0.9 1.8 Dangerous 3.4 9.5 No
E:only-of-type Only child of type No 0.9 No Dangerous 3.4 9.5 No
E:nth-child Nth child No 0.9 No No 3.4 9.5 No
E:nth-last-child Nth last child No 0.9 No No 3.4 9.5 No
E:nth-of-type Nth child of type No 0.9 No No 3.4 9.5 No
E:nth-last-of-type Nth last child of type No 0.9 No No 3.4 9.5 No
E:target Target No 0.9 1.3 Partial 3.4 9.5 No
E:empty Empty No 0.9 1.8 412 3.4 9.5 No
E:not() Negation No 0.9 1.0 85 3.4 9.5 No
E:enabled Enabled state No 0.9 1.8 522 3.4 9.0 No
E:disabled Disabled state No 0.9 1.8 522 3.4 9.0 No
E:checked Checked state No No 1.0 522 3.4 9.0 No
E:indeterminate Indeterminate state No 0.9 No No No No No
E:default Default No No 1.9 No No 9.0 No
E:valid Valid No No 1.8 No No 9.0 No
E:invalid Invalid No No 1.8 No No 9.0 No
E:in-range In range No No 1.8 No No 9.0 No
E:out-of-range Out of range No No 1.8 No No 9.0 No
E:required Required No No No No No 9.0 No
E:optional Optional No No No No No 9.0 No
E:read-only Read-only No No Experimental No No 9.0 No
E:read-write Read and write No No Experimental No No 9.0 No
Pseudo-elements
CSS2 E:first-letter First letter 5.5 0 1.0 85 Yes 7.0 3.0
E:first-line First line 5.5 0 1.0 85 Yes 7.0 3.0
E:before Before No No 1.0 85 Yes 7.0 3.0
E:after After No No 1.0 85 Yes 7.0 3.0
CSS3 E::before Double colon notation No No 1.5 85 3.4 7.0 Yes
E::after Double colon notation No No 1.5 85 3.4 7.0 Yes
E::first-letter Double colon notation No 0.9 1.5 85 3.4 7.0 Yes
E::first-line Double colon notation No 0.9 1.5 85 3.4 7.0 Yes
E::selection Selection No 0.9 Experimental 412 3.4 No No
E::value Double colon notation No No No No No No No
E::choices Double colon notation No No No No No No No
E::repeat-item Double colon notation No No No No No No No
E::repeat-index Double colon notation No No No No No No No
  Trident Tasman Gecko WebCore KHTML Presto iCab

Trident selector notes

  1. :active ? :active is for anchor element only.
  2. :hover ? :hover is applied for all elements only in standards-compliant mode, not quirks mode [1]. Prior to 7.0, :hover is for anchor element only.
  3. .one.two ? only .two class selector was taken into consideration before 7.0.
  4. * ? Prior to 7.0 this was treated as a single or no element.

Tasman selector notes

  1. :hover ? For anchor element only prior to 0.9.
  2. .one.two ? only .two class selector is taken into consideration.

WebCore selector notes

  1. :lang() ? Only detected when explicitly present on element being tested, attribute not inherited.
  2. :target ? Style doesn't get applied when navigating using back and forward buttons.
  3. :last-child & :last-of-type ? will match all siblings, or all siblings of the same type, respectively.
  4. :only-child & :only-of-type ? identical behaviour to :first-child & :first-of-type.
  5. ::pseudo-element ? Mistakenly also triggers on ::pseudo-class prior to version 416.0.

Properties

  Trident Tasman Gecko WebCore KHTML Presto iCab
Box model
CSS2 margin 4.0 0 1.0 85 Yes 7.0 3.0
padding 4.0 0 1.0 85 Yes 7.0 3.0
width 4.0 0 1.0 85 Yes 7.0 3.0
height 4.0 0 1.0 85 Yes 7.0 3.0
float 5.0 0 1.0 85 Yes 7.0 3.0
clear 5.0 0 1.0 85 Yes 7.0 Yes
display Partial Partial Partial 85 Yes 7.0 Partial
min-width 7.0 0.9 1.0 416 Yes 7.0 3.0
max-width 7.0 0.9 1.0 416