Declarations and Structure Tags in HTML 5
Including <html>, <head> and <body> Tags
Declarations for HTML 5
- <?xml?> declaration
- The <?xml?> declaration indicates the what character encoding, such as UTF-8 for Unicode or ASCII, has been used to encode the document. It also indicates that the document can be processed by aggregators and other generic XML parsers in addition to HTML browsers.
- DOCTYPE declaration
- The DOCTYPE declaration indicates that the document should be displayed according to the HTML 5 specifications, which results in more consistent appearance in different web browsers. Note that there is no DTD in HTML 5.
Processing Instructions for HTML 5
- xml style sheet instruction (XSLT)
- The
xml-stylesheet
processing instruction can be used to reference XSLT templates, which can be applied to multiple web pages, to avoid repeating the code for common elements on all web pages, and can be cached on the client side by web browsers, to improve page load times.
Document Structure Tags in HTML 5
The purpose of the structure elements is to provide a single element containing all other HTML code for the document and to separate the page title and other metadata information in the head section from the actual visible content of the document in the body section.
- <html> tag
- The <html> tag is the top element of an HTML document and encloses all of the other HTML code for the document. Only HTML declarations and HTML comments should appear outside the html element.
- <head> tag
- A single <head> tag encloses metadata about the HTML document that is not directly displayed to the user but can be used by HTML browsers.
- <body> tag
- A single <body> tag encloses the visible content of the HTML document.