The HTML title attribute provides additional information about an element, typically displayed as a tooltip when the user hovers over it.
- Can be used with most HTML elements.
- Displays extra information as a tooltip on hover.
- Improves user understanding of content or actions.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>title attribute</title>
<style>
body {
text-align: center;
}
h1 {
color: green;
}
</style>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>title attribute</h2>
<!--Driver Code Ends-->
<p title="GeeksforGeeks: A computer science
portal for geeks">
GeeksforGeeks.org
</p>
<!--Driver Code Starts-->
</body>
</html>
<!--Driver Code Ends-->
Syntax:
<element title = "text">The title attribute specifies extra information about an element, usually shown as a tooltip on hover.