Codectionary / Developer documentation / HTML

<title>

The <title> element defines the title of the document, shown in the browser tab, bookmarks, and search engine results. Every HTML document should have exactly one <title>, placed inside <head>. It must contain only text — no nested elements.

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