DEV Community

Cover image for HTML tags | title
Carlos Espada
Carlos Espada

Posted on

HTML tags | title

It is used to define the title of the document. It always goes inside <head>.

It can only contain text, any label inside it will be ignored.

It is a mandatory and unique element, you cannot have more than one <title> in an HTML document.

Is used for:

  • Show in title bar or browser tab.
  • Provide a title to the page when it is added to favorites.
  • Show a title for the page in search engine results.

Title content is very important for SEO, as it is one of the components used by search algorithms to decide in what order the page will appear.

Some tips for writing good titles:

  • It is better to be long and descriptive than short and generic (avoid titles of 1 or 2 words).
  • Search engines usually show only the first 50-60 characters, so the length should not exceed that amount. If you have to, it is a good idea to make sure that the important information in the title is at the beginning and that no important content falls within the part that can be hidden.
  • Don't use keyword lists, as it can lower your search results.
  • Try to be as accurate and meaningful as possible.
  • Try to be as unique as possible within the site itself. Duplicate or near-duplicate titles can contribute to inaccurate search results.

A very common navigation technique for assistive technology users is to first read the <title> and deduce the content of the page from there, since determining it from directly navigating the page is time consuming and can be confusing. Hence, providing a title that is descriptive of the purpose of the page is so important to these users.

The <title> has to be updated to reflect significant changes in the state of a page, for example when there are problems with the validation of a form.

  • Type: none
  • Self-closing: No
  • Semantic value: No

Definition | Example | Support

Discussion (0)