HTML <title> for Title in Head Section


ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.

If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

PDF mobile

The <title> Tag in HTML 5

The <title> tag is coded in the HTML head section and contains the text that is to appear in the web browser's title bar and various other places. It can be used in favorite bookmarks, browser history or search results and therefore should be a good description of the document for any of those purposes.

<title> Tag Syntax

   ... metadata content ...
   <title>... text content ...</title>
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.

  1. Inside a head element where metadata content is allowed, code a single required title element.
  2. 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.
  3. Code the text for the document title between the start tag and the end tag.
  4. 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 &lt; and, as in any HTML code, ampersands should be escaped as &amp;.

HTML comments should not be coded inside a title element. (See the issues with HTML 5 comments.)

<title> Tag Attributes

Attributes of the <title> tag
global attributes The only attributes that can be coded on the <title> tag are the common HTML attributes.

<title> Tag Examples

Examples of the title tag in HTML 5
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/site-template.xsl"?>
<!DOCTYPE html>
<html xmlns="">
      <link rel="stylesheet" type="application/xslt+xml" href="/site-template.xsl"/>
      <title>Example Only</title>

Changes in HTML 5 - <title> Tag

What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML

The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the title element type name along with the names of all HTML element types. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.

Issues with HTML comments in the <title> tag

When HTML comment code appears inside a <title> tag, where text content is expected, whether or not it is treated as comments depends on how the HTML document is being parsed. When it is being parsed as legacy HTML (for example, by IE 8 and some search engine crawlers), the code will be included in the text content. When the HTML document is being parsed as either xHTML, the XML serialization of HTML, or pure XML, the code will be treated as comments and will not appear in the displayed text. To avoid this, do not code comments in the <title> tag or other text content.

To escape text containing the comment delimiters (<!--) in text content so that it appears for all browsers, use a <![CDATA[...]]> section instead.

Valid HTML 5