Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 2: The Design of HTML5 > Give It to Me Straight, Doctype

Give It to Me Straight, Doctype

A Document Type Declaration, or doctype for short, has traditionally been used to specify which particular flavor of markup a document is written in.

The doctype for HTML 4.01 looks like this:

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

Here’s the doctype for XHTML 1.0:

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

They’re not very human-readable, but, in their own way, they are simply saying “this document is written in HTML 4.01,” or “this document is written in XHTML 1.0.”

You might expect the doctype declaring “this document is written in HTML5” would have the number five in it somewhere. It doesn’t. The doctype for HTML5 looks like this:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint