Title Tag in HTML5
In this article I am going to describe about the use of Title Tag in HTML5.
Title Tag
The title element represents the document title or the name.The title attribute use to show message about any element in HTML document. Message will be shown on mouse hover.
In HTML5, the title attribute can be used on any HTML element (it will validate on any HTML element. However, it is not necessarily useful).
In HTML 4.01, the title attribute cannot be used with: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.
When to use Title Attribute
- Do not use title attribute , on any element, for any text that you want all users to have access to.
- Only use it to label a form control when the same text is provided as visible text.
- Do not use it on a link to provide information that may be important to any user.
Browser Support
It is supported in all major browsers.
Syntax
<element title="text">
Attribute
Value |
Description |
text |
Specifies the Text for the element. |
Example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Title Attribute</title>
</head>
<body>
<h4>Implementation of Title Attribute in HTML5</h4>
<p title="Articles">C-Sharpcorner</p>
<p title="News">.Net Heaven</p>
</body>
</html>
Output
