<html> Tag Examples

Examples of the html tag in HTML 5

This is how the <html> tag should be used:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
      <title>Example Only</title>

The <html> tag should always include an xmlns attribute, which explicitly specifies the namespace of the HTML elements in the document. See the Changes below for more details. Additional namespaces, such as for MathML or RDF could also be included at this level.

Any HTML element, including the html element may also specify the language using the global lang attribute and, optionally, the global xml:lang attribute. The xml:lang attribute may be specified only if the lang attribute is also included.

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">