You are currently using a web browser that does not support HTML 5 with style sheets. Please try the standard HTML 5, XHTML 1 or XHTML 1 Mobile version of this page instead.

HTML 5 Document Structure

HTTP Headers for HTML

The HTTP headers which control how an HTML 5 document is displayed might look like this:

Content-Type: application/xhtml+xml; charset=UTF-8
Cache-Control: max-age=120
X-UA-Compatible: IE=8

It is highly recommended that the charset attribute specifying the character encoding of the HTML page be included in the Content-Type header for non-XML user agents in addition to the xml declaration.

Converting to HTML 5

We are working on converting to HTML 5. Please visit Basic HTML Structure on the HTML 5 standard version of this site.

How to set the Content-Type for the HTML 5 MIME Type

If the web documents are being created by a program, the programming language probably has an API to send the proper HTTP headers.

For static web pages, it may be necessary to add the MIME Type for HTML 5 Polyglot Documents to the HTTP web server configuration to send the appropriate Content-Type header. With the Apache HTTP Server, for example, the HTML 5 MIME Type can be added to the .htaccess file(s):

DirectoryIndex index.html
ErrorDocument 404 /error.html
AddType application/xhtml+xml;charset=UTF-8 html

The type of serialization of an HTML document refers to the syntax used when converting the HTML from an internal document model to a stream of bytes to be stored or transmitted. The XML style of serialization has a number of advantages, including:

HTML 5 has been designed to be relatively backward compatible with both the 1997-1999 HTML 4 standard and the 2000-2001 XHTML 1.x W3C recommendation of HTML. The XML serialization of HTML 5 merges these two standards, and is already understood by virtually all web browsers including XHTML-based mobile browsers. Polyglot HTML documents can be delivered either as text/html to traditional web browsers or as application/xhtml+xml to web browsers on computers as well as in cell phones and other handheld devices. If you start creating polyglot documents now your web pages will be well positioned for both current and future HTML browsers and mobile devices.

The typical code for a simple HTML version 5 page would look something like the following (this is the HTML equivalent of a "Hello World" program):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Example Only</title>
  </head>
  <body>
    <p>This is only an example. For more information, see
      <a href="
http://www.ExampleOnly.com/" alt="ExampleOnly.com"/>
    </p>
  </body>
</html>

Last updated Sunday September 19, 2010


Printer-friendly PDF* format:

HTML 5 Tutorial

You are currently viewing this page in HTML 5 Style Sheet* format (* see Clicklets for more infomation). This document is also available in HTML 5 XML*HTML 5 non-XML*XHTML 1 Style Sheet*XHTML 1*XML* HTML 4* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.