English-only | Jenom česky | Bilingual/Dvojjazyčně

HTML: DOCTYPE And Browser Modes

Modern browsers use the "doctype sniffing" to distinguish older and newer versions of the (X)HTML languages. The proper formatting mode is selected according to the specified document type. The page is then formatted either in an obsolete, but more compatible way (non-standard, quirk mode) — or using modern standards (standard mode).

Following table shows modes corresponding to common DTDs in well known browsers, which use the doctype sniffing — this means Netscape6/Mozilla (NN6/Moz), MS Internet Explorer 6 on Windows (IE6/Win) and MS Internet Explorer 5 on MacOS (IE5/Mac).


Document's type according to the DTD specified in the DOCTYPE element
NN6,Moz IE6/Win IE5/Mac

Without specifying DTD in DOCTYPE
quirk quirk quirk

HTML 3.2 and older, e. g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
quirk quirk quirk

Any strict HTML 4.x, e. g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
STD STD STD

Any transitional HTML 4.x without URL, e. g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
quirk quirk quirk

Transitional HTML 4.0 with URL, e. g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
quirk STD STD

Transitional HTML 4.01 with URL, e. g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
p-STD STD STD

Strict XHTML 1.0 without XML declaration, e. g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
STD STD STD

Strict XHTML 1.0 with XML declaration, e. g.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
STD quirk STD

Transitional XHTML 1.0 without XML declaration, e. g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
p-STD STD STD

Transitional XHTML 1.0 with XML declaration, e. g.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
p-STD quirk STD

The "STD" is a standard mode, when the browser honours techniques and formatting specified by the W3C standards as much as possible. The "p-STD" is a pseudo-standard mode — the standards aren't fully honoured, some algorithms are adopted from older browsers to keep higher compatibility. MSIE doesn't have this mode, but his standard mode rather corresponds to the "p-STD" mode in NN6/Moz. The "Quirk" mode is non-standard, according to techniques used in old browsers (MSIE 6 in quirk mode displays a page mostly as same as MSIE 5, Mozilla in quirk mode uses some formatting of NN4 etc.)

Detailed information about doctype sniffing and formatting documents according to the browser's modes can be found on many other web sites, e. g.: