<title>

The HTML <title> element specifies the document's title, which appears in the browser's title bar or tab. It aids in search engine indexing and helps identify the page.

<title> tag

The <title> element in HTML defines the title of a document. This title appears in the browser's title bar, search results, and bookmarks. It should accurately represent the page's content.

Syntax

index.html
<element title="tooltip text">Content</element>

<title> Demo

This is a heading

This is a paragraph.

index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <title>HTML Elements Reference</title>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Purpose and Usage

  • The <title> tag specifies the webpage's title and must contain only text. It appears in the browser's title bar or tab.
  • Including the <title> tag is mandatory in HTML documents.
  • A well-crafted title is crucial for search engine optimization (SEO), as search engines use it for ranking pages in search results.

Functions of the <title> Tag:

  • Displays the page title in the browser’s toolbar.
  • Provides a title when the page is bookmarked.
  • Appears in search engine results as the page’s heading.

Best Practices for Creating Titles:

  • Use descriptive and meaningful titles instead of short, vague ones.
  • Keep the title within 50-60 characters for optimal display in search results.
  • Avoid using a list of unrelated words, as this may negatively impact search rankings.
An HTML document should contain only one <title> element.

Attributes

This element only includes the global attribute.

Default CSS Settings

Most web browsers apply the following default settings to the <title> element:

style.css
title {
  display: none;
}
You cannot have more than one <title> element in an HTML document.

Conclusion

The <title> tag in HTML defines the webpage's title, appearing in the browser's title bar, search results, and bookmarks. It plays a key role in SEO and helps users identify the content of a page. A well-written title is essential for better search engine rankings and user experience. Each HTML document should have a single, descriptive <title> tag for optimal results.