ARCHIVED - Document Type Definition

Warning This information has been archived because it is outdated and no longer relevant.

Archived Content

Information identified as archived on the Web is for reference, research or recordkeeping purposes. It has not been altered or updated after the date of archiving. Web pages that are archived on the Web are not subject to the Government of Canada Web Standards. As per the Communications Policy of the Government of Canada, you can request alternate formats by contacting us.

Warning: This page contains very wide content. Horizontal scrolling may be necessary.

Table of Contents

1.0 Introduction

In order to produce valid CLF compliant Web pages, the Document Type Definition (DTD) must be declared at the beginning of each Web page. Each Web page must be designed with the full DOCTYPE declaration, so that Web devices (such as browsers and PDAs) can render the Web pages correctly.

2.0 DOCTYPE switching

Consistent browser support for W3C recommendations (such as HTML and XHTML) had not yet been established when the recommendations were first introduced. At that time developers were forced to produce Web pages that were non-conformant with W3C recommendations for them to render correctly across various platforms.

DOCTYPE switching was introduced to enable support for Web pages that are conformant to W3C recommendations without breaking support for pages that had already been developed using non-conformant approaches. In general, DOCTYPE switching involves two display modes: Quirks mode and Standards mode.

2.1 Quirks mode

Quirks mode was introduced to ensure support for Web pages that are non-conformant with W3C recommendations. Pages are normally rendered in Quirks mode when the full DTD is not provided at the beginning of the page.

Pages rendered in Quirks mode may vary significantly from browser to browser as the visual appearance is based upon each browser's interpretation of how the page was meant to be displayed.

2.2 Standards mode

Standards mode was introduced to enable support for Web pages that are conformant with W3C recommendations. Pages are normally rendered in Standards mode when the full DTD is provided at the beginning of the page.

Pages rendered in Standards mode tend to be consistent from browser to browser as the visual appearance is based upon W3C recommendations.

3.0 Valid Document Type Definitions

W3C Recommendation Compliant with CLF 2.0? Code
HTML5 Yes <!DOCTYPE html>
XHTML 1.0 Strict Yes <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Frameset Yes <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
XHTML 1.0 Transitional No <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
HTML 4.01 Strict No <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Frameset No <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
HTML 4.01 Transitional No <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

4.0 Further reading