Tutorials 参考 练习 Menu
Paid Courses

HTML <title> Tag


Example

Define a title for your HTML document:

<!DOCTYPE html>
<html>
<head>
  <title>HTML元素 参考</title>
</head>
<body>

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

</body>
</html>
来试试吧 »

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头

HTML DOM reference: Title Object


Default CSS Settings

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

title {
  display: none;
}





W3Schools is optimized for learning and training. 示例 might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2021 by Refsnes Data. All Rights Reserved.
W3Schools is Powered by W3.CSS.