About DOCTYPE declaration
The DOCTYPE declaration tells the browser what version of HTML is being used.
This declaration must be the first thing in the document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
</body>
</html>
HTML 4.01 DTD - Document Type Definition
There are three document types for HTML 4.01 : Strict, Transitional, and Frameset.
Strict DTD: For strict documents
Deprecated elements and attributes, frames, and link's target are not allowed in Strict DTD.
URL present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
URL not present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
Transitional DTD: For transitional documents
Deprecated elements and attributes, and link's target are allowed in Transitional DTD, but frames is not allowed.
URL present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
URL not present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Frameset DTD: For documents that use frames
Frameset DTD is like Transitional DTD, but frames is allowed. Use this DTD for documents that use frames.
URL present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
URL not present
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
DOCTYPE switch
The DOCTYPE switch is used to switch rendering modes in the modern browsers.
There are the following two modes.
- Standards mode : The strict rendering mode.
- Quirks mode : The backwards compatible mode.
Doctype | URL | IE | Firefox | Opera |
---|---|---|---|---|
Strict | present | Standards | Standards | Standards |
not present | Standards | Standards | Standards | |
Transitional | present | Standards | Standards | Standards |
not present | Quirks | Quirks | Quirks |