Description

The HTML element <title> is used to define a title to an HTML document.

The title must be defined only once and must be the first element defined within the <head> element, which can ideally extend to a length of 65 characters.

The document title must be meaningful and summarizes the content and purpose of the document.

It is very important to define a proper title for all the HTML documents.

  • The browsers use the title to display it in the browser tabs, which are also used as the titles for the browser bookmarks.
  • The search engines use the title to create a clickable link to the document, which determines the page content.

The below table summarizes its usage.

Usage Details
Placement It must be defined within the <head> element.
Contents It can contain text.
Tags Both the opening and closing tags are required.
Versions HTML 2, 3.2, 4, 4.01, 5

Syntax

Here is the basic syntax of the <title> element.

<title>...</title>

Examples

Run this on IDE

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example - HTML Element title</title>
</head>
<body>
    <p>The page title appears on a browser tab.</p>
</body>
</html>

Attributes

The following table shows the list of supported and unsupported attributes for the <title> element.

Attribute Type Details
Element-Specific Attributes The tag <title> has some element-specific attributes listed in the below table.
Global Attributes Like all other HTML tags, the tag <title> supports the HTML Global Attributes.
Event Attributes The tag <title> also supports the HTML Event Attributes.

Here is a list of attributes that are specific to the <title> element.

Attribute Value Required Description
datetime DateTime No Specifies the date and/or time that the element represents.

Browser Compatibility

The tag <title> is supported in all modern browsers.

  • Google Chrome 1+
  • Internet Explorer or Edge 2+
  • Firefox 1+
  • Apple Safari 1+
  • Opera 2.1+

Related Links