HTML title tag (2024)


Example

Define a title for your HTML document:

<!DOCTYPE html>
<html>
<head>
<title>HTML Elements Reference</title>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Try it Yourself »

Definition and Usage

The <title> tag defines the title of the document. The title must be text-only, and it is shown in the browser's title bar or in the page's tab.

The <title> tag is required in HTML documents!

The contents of a page title is very important for search engine optimization (SEO)! The page title is used by search engine algorithms to decide the order when listing pages in search results.

The <title> element:

  • defines a title in the browser toolbar
  • provides a title for the page when it is added to favorites
  • displays a title for the page in search-engine results

Here are some tips for creating good titles:

  • Go for a longer, descriptive title (avoid one- or two-word titles)
  • Search engines will display about 50-60 characters of the title, so try not to have titles longer than that
  • Do not use just a list of words as the title (this may reduce the page's position in search results)

So, try to make the title as accurate and meaningful as possible!

Note: You can NOT have more than one <title> element in an HTML document.

Browser Support

Element
<title> Yes Yes Yes Yes Yes

Global Attributes

The <title> tag also supports the Global Attributes in HTML.

Related Pages

HTML tutorial: HTML Head

HTML DOM reference: Title Object

Default CSS Settings

Most browsers will display the <title> element with the following default values:

title {
display: none;
}

W3schools Pathfinder

Track your progress - it's free!

HTML title tag (2024)

FAQs

What is the title tag in HTML? ›

The <title> tag defines the title of the document. The title must be text-only, and it is shown in the browser's title bar or in the page's tab. The <title> tag is required in HTML documents! The contents of a page title is very important for search engine optimization (SEO)!

How do I add a heading in HTML? ›

HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading.

How do I add a title to a button in HTML? ›

HTML <button> title Attribute

The title attribute on a <button> tag adds a tooltip with title text to the button. Hovering the mouse over the button will display the tooltip.

How to find title tag? ›

A title tag is an HTML tag — written <title>, under the <head> section — that labels your page for both real people and search engines. In SERPs, titles appear as the blue text that people click to navigate to your page. They also appear at the tops of browser tabs.

How do you write a title tag? ›

Use a unique title for every title tag you create, one that shows the value of your content to both search engines and users. SEO good practices suggest that each piece of content you create should be different. Your title tags should reflect the unique information you describe on each page.

What is a heading tag? ›

Header tags, also known as heading tags, are used to separate headings and subheadings on a webpage. They rank in order of importance, from H1 to H6, with H1s usually being the title. Header tags improve the readability and SEO of a webpage.

What is an example of a HTML heading? ›

The heading elements are H1, H2, H3, H4, H5, and H6 with H1 being the highest (or most important) level and H6 the least. For example: <H1>This is a top level heading</H1> Here is some text. <H2>Second level heading</H2> Here is some more text.

How to make a good header in HTML? ›

Example
  1. /* Style the header with a grey background and some padding */ ...
  2. /* Style the header links */ ...
  3. /* Style the logo link (notice that we set the same value of line-height and font-size to prevent the header to increase when the font gets bigger */ ...
  4. /* Change the background color on mouse-over */

How to align a heading in HTML? ›

Headings and paragraphs are tags sharing the same level of importance. If you want a heading being aligned to the center write (outside the <p>... </p>) <h1 align="center">Centered Heading1</h1>.

What is a title attribute? ›

Definition and Usage

The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.

How do I add a title icon in HTML? ›

In the head section of your (X)HTML document, type <link rel="icon" href="favicon. ico" type="image/x-icon"/>, where favicon. ico is the name and location of your icon on your server.

How to set title for input in HTML? ›

The title attribute is placed in the <input> tag. The value can be any string. Hover the mouse over the input field and after a second a tooltip appears.

How do I insert a title in HTML? ›

Create your HTML in a program like Atom, Brackets, TextEdit, or Notepad++. Add the <title>Something</title> Title Tag to your code. Change "Something" to the title you want and save the file.

What does an HTML title tag do? ›

The title tag is an HTML code tag that allows you to give a web page a title. This title can be found in the browser title bar, as well as in the search engine results pages (SERP).

How to create an HTML tag? ›

HTML tags are special keywords that specify how a web browser must format and display the content. Tags are wrapped in brackets < and >. They start with an open angle bracket (<) and close with a closed angle bracket (>). The ending tag has a forward slash before the name of the element.

What is a tag in HTML example? ›

HTML tags are the keywords on a web page that define how your web browser must format and display your web page. Almost all tags contain two parts, an opening, and a closing tag. For example, <html> is the opening tag and </html> is the closing tag.

What is the tag title of a table in HTML? ›

The HTML <caption> tag defines the title of a table in the HTML document. Browsers traditionally render the text found in the <caption> tag above the table, but you can change this behavior with the CSS caption-side property.

What is a site title example? ›

Further, the title should let browsers know if this site suits their needs for what they want or not. With that, the right audience will drive to your site. For example, the site title of SiteSaga is 'SiteSaga – The Best Resource to Help You Make a Website'.

Does a <! doctype html tag is an HTML tag? ›

All HTML documents must start with a <!DOCTYPE> declaration. The declaration is not an HTML tag. It is an "information" to the browser about what document type to expect.

Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated:

Views: 5810

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.