<title>
<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
<element title="tooltip text">Content</element>
<title>
Demo
This is a paragraph.
<!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.
<title>
Tag: Functions of the
- 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.
<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:
title {
display: none;
}
<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.
<template>
The <template> element in HTML enables the creation of reusable HTML snippets that are inactive and not displayed until triggered by JavaScript. This feature facilitates modular and dynamic content generation within web pages.
Semantics
HTML semantic elements are tags that convey meaningful structure and content, improving accessibility and SEO, such as (<header>), (<footer>), and (<article>).