Home > Articles > Web Development > HTML/CSS

  • Print
  • + Share This
This chapter is from the book

The Title

Each HTML page needs a title to indicate what the page describes. It appears in the title bar of the browser when people view the web page. The title is stored in your browser’s bookmarks and in search engines when they index your pages. Use the <title> tag to give a page a title.

<title> tags are placed within the <head> tag and are normally used to describe the contents of the page, as follows:

<!DOCTYPE html><html>
<head>
<title>The Lion, The Witch, and the Wardrobe</title>
</head>
<body>
...your page...
</body>
</html>

Each page can have only one title, and that title can contain only plain text; that is, no other tags should appear inside the title.

Try to choose a title that’s both short and descriptive of the content. Your title should be relevant even out of context. If someone browsing on the Web follows a random link and ends up on this page, or if a person finds your title in a friend’s browser history list, would he have any idea what this page is about? You might not intend the page to be used independently of the pages you specifically linked to it, but because anyone can link to any page at any time, be prepared for that consequence and pick a helpful title.

Also, because browsers put the title in the title bar of the window, you might have a limited amount of space. (Although the text within the <title> tag can be of any length, it might be cut off by the browser when it’s displayed.) Here are some examples of good titles:

<title>Poisonous Plants of North America</title>
<title>Image Editing: A Tutorial</title>
<title>Upcoming Cemetery Tours, Summer 1999</title>
<title>Installing the Software: Opening the CD Case</title>
<title>Laura Lemay's Awesome Home Page</title>

Here are some not-so-good titles:

<title>Part Two</title>
<title>An Example</title>
<title>Nigel Franklin Hobbes</title>
<title>Minutes of the Second Meeting of the Fourth Conference of the
Committee for the Preservation of English Roses, Day Four, After Lunch</title>

Figure 4.1 shows how the following title looks in a browser:

<title>The Lion, the Witch, and the Wardrobe</title>
FIGURE 4.1

FIGURE 4.1 The title appears in the tab bar, not on the page.

  • + Share This
  • 🔖 Save To Your Account