HTML doctype

Previous
Next

HTML Versions: The following table represents the years and versions

VersionYear
HTML1991
HTML 2.01995
HTML 3.21997
HTML 4.011999
XHTML2000
HTML52014

Simple HTML document :

<!DOCTYPE html>
<html>
	<head><title>Page Title</title></head>
	<body>
		<h1>My First Heading</h1>
		<p>My first paragraph.</p>
	</body>
</html>

DOCTYPE :

  • “DOCTYPE” means HTML document type.
  • Every HTML document requires a document type declaration.
  • The DOCTYPE declaration defines the document type to be HTML.
  • It tells a validator about the version is using in HTML document to be interprete.
  • The <!DOCTYPE> declaration helps the browser to display a web page correctly.
  • There are several document types on the web.
  • To display a document correctly, the browser must know both type and version.
  • The doctype declaration is not case sensitive. All cases are acceptable.
  • Earlier doctype declarations were hard-to-remember.

For XHTML 1.0 Strict:

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

And for HTML4 Transitional:

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

HTML5 provides solution, in HTML5 document we just need to provide “DOCTYPE” element as follows.

<!DOCTYPE html>
<!DOCTYPE HTML>
<!doctype html>
<!Doctype Html>

Note: All the above declarations are true.

Previous
Next

Add Comment

Courses Enquiry Form