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.
<html>
<head>
<title>title attributetitle>
<style>
body {
text-align: center;
}
h1 {
color: green;
}
style>
head>
<body>
<h1>GeeksforGeeksh1>
<h2>title attributeh2>
<p title="GeeksforGeeks: A computer science
portal for geeks">
GeeksforGeeks.org
p>
body>
html>
Syntax:
The title attribute specifies extra information about an element, usually shown as a tooltip on hover.