HTML Title
HTML title tag is used to provide a title name for your webpage. It is necessary for Search Engine Optimization (SEO).
The HTML title tag must be used inside the <head> tag.
The title of the page is displayed on the title bar of the browser.
Example of HTML title tag.
<!DOCTYPE html>
<html>
<head>
<title>HTML Title Example | First web page.</title>
</head>
<body>
<p>HTML Title Example : Welcome to my first web page.</p>
</body>
</html>
Here you see that we are using two elements, the head tag and the title tag. The whole title element is within the head tag.
The head element which appears before body element just contains the information about the page but it doesn't display on the browser window. So, to display a title name on the web page, title element is used.
If you look at the above example, you will see that "HTML Title Example | First web page" will be displayed on the tab/ title bar of the browser. Content(text) between <title>.............</title> is shown on the title bar.
On the HTML document you have often seen that there is a <!DOCTYPE html> declaration before the <html> tag. This <!DOCTYPE html> declaration is not an HTML tag. It is used to instruct the web browser about the HTML page.
Actually, there are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc.
The <!DOCTYPE> declaration refers Document Type Declaration (DTD) in HTML 4.01; because HTML 4.01 was based on SGML. But HTML 5 is not SGML based language.
DTD defines the rules for the markup languages so that the browsers recognize the content correctly.
The doctype declaration differs between HTML versions. The HTML 5 doctype declaration is given below.
<!DOCTYPE html>
Example of HTML document with doctype declaration.
<!DOCTYPE html>
<html>
<head>
<title>This is the title</title>
</head>
<body>
This is the content of the document.
</body>
</html>
Element | Chrome | IE | Firefox | Opera | Safari |
<title> / <!DOCTYPE html> | Yes | Yes | Yes | Yes | Yes |
© 2025 Easy To Learning. All Rights Reserved | Design by Easy To Learning