Tidy 44

From Htmlpedia
Jump to: navigation, search

Tidy: Warning: missing <!DOCTYPE> declaration

Cause:

A DOCTYPE Declaration is mandatory for most current markup languages and without one it is impossible to reliably validate a document. The DOCTYPE defines the version of the document like : HTML 4.0.1, XHTML 1.0, 1.1, ...

Examples:

Bad
<html>
<head>
<title>document without DOCTYPE</title>
</head> ...
Good
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>XHTML-document</title>
</head> ...
Good
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>HTML-document</title>
<head> ...

Solution:

Please place a DOCTYPE declaration as the very first thing in an HTML document.

References: