<title> Tag Syntax
<head> ... metadata content ... <title>... text content ...</title> ... </head>
Rules for coding the HTML title
element
Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.
- Inside a head element where metadata content is allowed, code a single required title element.
- Begin the title element with a starting <title> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - Code the text for the document title between the start tag and the end tag.
- End the title element with a matching </title> closing tag.
<title> Content Model
Contents of the <title> Tag
The title element should only contain text. It is not allowed to have any child elements. Style tags such as for italic (<i>) or bold text (<b>) would not work anyway since the appearance of the window title is determined by the operating system. Since it cannot contain any tag markup, any <
symbols must be escaped as <
and, as in any HTML code, ampersands should be escaped as &
.
HTML comments should not be coded inside a title element. (See the issues with HTML 5 comments.)