The HTML title tag defines the title of an HTML page and stores heading elements. It’s used with the
<title> tag and placed in the head section of an HTML file.
When you’re building a web page, you’ll want to specify a title for that webpage. For instance, if you’re building a home page for a local bakery’s website, you may want the name of the bakery to appear as the title of the web page.
That’s where the
<title> HTML tag comes in. The
<title> tag defines the title of a document in HTML and is placed within the head section of a web page. This tutorial will discuss, with reference to an example, the importance of the
<title> tag, and how you can use it in your code.
In HTML, the
<head> element is used to store heading elements. These elements provide additional information about a web page, such as the icon that should appear for the web page, the title of the page, and the meta descriptions which should appear if the page is linked to on another site.
Together, the elements in the
<head> section describe core information about a document and can point the browser to the style sheets and scripts used in a document (if any are used).
<title> tag is used to define the title of the document. This tag appears within the
<head> tag, and should summarize the purpose of a web page.
There are a number of reasons why specifying a document title tag is important.
<title> tag displays the page title in the web browser’s tabs. For instance, the title of this page is
HTML Title Tag, which appears in the name of this site’s tab.
<title> tag labels the web page when it is bookmarked or saved as a favorite in the user’s web browser. The title you specify will be the one automatically saved, and so if you don’t use an appropriate title for a webpage, a user may find it difficult to discover your page when they are searching through their bookmarked or favorited sites.
In addition, search engines also depend on the contents of a title tag. The title specified in a title tag will be used to display the headline for a web page when it is displayed on a Search Engine Result Page (SERP). The contents of the
<title> tag will also be used to determine the topic of the web page by search engines.
So, now we know that
<title> tags are important, you may be asking the question: how do I use the HTML title tag? Let’s answer that question.
HTML Title Tag Syntax
The HTML title element is defined within the
<head> tag on a HTML page. Suppose we are building a web page for our local bakery, Joseph Abrams & Sons. We are currently building the home page, and we want the name of the bakery to appear in the site’s title.
We could use the following code to set the title of our page to
Joseph Abrams & Sons.:
<head> <title>Joseph Abrams & Sons.</title> </head>
When the web page for our site is opened, the title of the page is set to
Joseph Abrams & Sons.
The title tag does not have any element-specific attributes, and the tag can only be used once within a head section.
In addition, when you’re using a title tag you should be sure to keep your title short and appropriate given the contents of the web page you are building.
For example, if we were building a contact page for our local bakery from earlier, we may want to use the title
Contact | Joseph Abrams & Sons. This title is simple and also describes the purpose of our web page well.
The HTML title tag supports all global attributes in HTML5, and the tag is supported by all major modern browsers.
<title> tag is used to define the title of an HTML document. This title appears in the web browser’s title and tab names and is also used by search engines when processing a web page to decide on its headline and topic.
This tutorial discussed, with reference to an example, the basics of the HTML
<title> tag. Now you’re ready to start using the title tag like an HTML expert!