HTML and CSS Reference
In-Depth Information
Now that you have seen some of the interesting things that can go in an
HTML document's body, it is time to learn what else is in its head. Here are a
few facts about head elements to guide your understanding:
.
Head elements are a mixed bag of diferent tags, many of which do
nothing.
.
he title element is required. All other head elements are optional.
.
Head elements are rarely nested inside each other. Most are self-closing.
.
HTML comments can go in the document head. hey are always useful.
.
he order of elements in the head generally does not matter.
Ordering does matter with
style
and
script
elements in that later CSS rules
can override earlier ones, and a JavaScript function deined with a given name
replaces any earlier deined function that has the same name. But it does not
matter if
style
elements are placed before
script
elements or vice versa.
he
meta
element, or tag, represents various kinds of information about a
document that cannot be expressed using the
title
or other elements.
The
meta
element has three diferent uses, depending on which of the three follow-
ing attributes is present in the self-closing tag:
name
,
http-equiv
, or
charset
.
Only one of these attributes can be present in a meta element.
If either the name or
http-equiv
attribute is present, the
content
attribute
must also be present. Without
content
attributes, these meta elements have no
reason to exist. he
charset
attribute speciies the character encoding to apply
to the document's data. A document should have only one
meta
element with a
charset
attribute. Here's an example:
<meta charset="utf-8"/>
meta
elements with
name
attributes say things about a document. Each such
meta
element deines one item of data expressed as a name/value pair using the
name
and
content
attributes, respectively. For example:
<meta name="author" content="Murasaki Shikibu"/>