HTML and CSS Reference
In-Depth Information
appear on any element in HTML. Including them on the root html element declares the language and
directionality for the entire document.
Listing 3-2. Internationalization attributes in a document's root element
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<title>Document Title</title>
</head>
<body>
<p>This is a very simple web page.</p>
</body>
</html>
The html element can also carry an optional manifest attribute, the value of which is the URL of an
application cache manifest . This file informs the browser about data resources that it can cache locally on
the user's computer for later use when it isn't connected to the Internet. Offline application caching is one
of the great new APIs introduced with HTML5 that, alas, we won't be covering in any detail in this
book. You can find a brief introduction to the ApplicationCache API at HTML5 Rocks
( html5rocks.com/en/tutorials/appcache/beginner/ ) and you can read all the gritty details in the
W3C specification ( w3.org/TR/html5/offline.html ).
Required Attributes
The html element doesn't require any attributes.
Optional Attributes
manifest : the URL of an application cache manifest. This attribute's value must be a valid URL,
either relative or absolute, though absolute URLs must be within the same domain as the current
document.
head
The head element acts as a container for other elements that provide information about the document
itself, collectively known as the document's header . This metadata informs the browser about where to find
external scripts or style sheets, or embeds such scripts and style sheets directly in the document,
establishes relationships between the current document and other resources, and can provide additional
data that's useful for user-agents but isn't intended for human visitors. Apart from the required title
element, covered next in this chapter, browsers don't display any of the metadata content within the head
at all; the header isn't part of the rendered web page.
The head element must be the first child of the html element; no other content or elements can appear
before it. However, like the html element, you can opt to omit the head element's start and end tags and
the element is still implied to exist. If you do omit the head element, any of the metadata content that would
ordinarily occur inside it must still come before any body content.
 
Search WWH ::




Custom Search