Syntax
<title>Page Title</title>Examples
Basic Page Title
A simple, descriptive page title.
<head>
<title>Codectionary - Learn to Code</title>
</head>Dynamic Page Title Pattern
A common convention for per-page titles with a site name suffix.
<title>HTML Documentation | Codectionary</title>Updating Title with JavaScript
Changing the title dynamically, such as for unread notifications.
<script>
document.title = `(3) New Messages - Codectionary`;
</script>Best practices
- Every page needs a unique, descriptive title — it is one of the most important elements for both SEO and usability
- Keep titles concise, roughly under 60 characters, so they do not get truncated in search results
- Put the most important, distinguishing information first, since browser tabs truncate from the right
- Never leave title empty or generic like "Untitled Document" — it directly affects how your page appears in search results and browser history
At a glance
- Purpose
- Structure and meaning for web content
- File extension
- .html · .htm
- Runs in
- Web browsers
- Usually used with
- CSS and JavaScript
Specifications & further reading
Related HTML documentation
<meta>
The <meta> element provides metadata about the HTML document that is not displayed on the page itself — used for things like character encoding, viewport configuration, page descriptions for search engines, and social media preview data. Meta tags live inside the <head> and are void (self-closing) elements.<link>
The <link> element establishes a relationship between the current document and an external resource, most commonly a stylesheet. It lives in the <head> and is a void element. Beyond stylesheets, <link> is also used for favicons, preloading resources, and specifying alternate versions of a page.<base>
The <base> element specifies a base URL and/or target for all relative URLs in a document. It must appear inside <head>, and a document should have no more than one <base> element. Once set, every relative link, image src, and form action on the page resolves against it unless individually overridden.<style>
The <style> element contains embedded CSS rules that apply directly to the current document, as an alternative to linking an external stylesheet with <link>. It normally lives inside <head>, though the scoped nature of modern CSS means it can technically appear in body content too.
The <meta> element provides metadata about the HTML document that is not displayed on the page itself — used for things like character encoding, viewport configuration, page descriptions for search engines, and social media preview data. Meta tags live inside the <head> and are void (self-closing) elements.<link>
The <link> element establishes a relationship between the current document and an external resource, most commonly a stylesheet. It lives in the <head> and is a void element. Beyond stylesheets, <link> is also used for favicons, preloading resources, and specifying alternate versions of a page.<base>
The <base> element specifies a base URL and/or target for all relative URLs in a document. It must appear inside <head>, and a document should have no more than one <base> element. Once set, every relative link, image src, and form action on the page resolves against it unless individually overridden.<style>
The <style> element contains embedded CSS rules that apply directly to the current document, as an alternative to linking an external stylesheet with <link>. It normally lives inside <head>, though the scoped nature of modern CSS means it can technically appear in body content too.