Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

title — document title

The `title` element defines an HTML document's title. It belongs in `head` and identifies the page outside its content, for example in bookmarks.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

<title>Document title</title>

title is metadata specifying the document's name. The title should identify the page outside its context, for example in history or bookmarks. It may differ from the h1 heading.

Place one title in head. A document must not contain more than one. It is normally required; exceptions include iframe srcdoc documents and cases where a higher-level protocol supplies the title.

Its content must be text, neither empty nor whitespace-only. Do not place child elements inside it. In HTML, both tags are mandatory. The element supports global attributes.

Do not confuse the title element with the title attribute, which provides advisory information about an element. document.title exposes the document's title; the text property of HTMLTitleElement reads or replaces the element's text.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>HTML basics | Study notes</title>
</head>
<body>
  <h1>HTML basics</h1>
</body>
</html>

Result

document.title: HTML basics | Study notes
h1: HTML basics

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources