The id attribute is used to specify the unique ID for an element of the HTML document. It allocates the unique identifier which is used by the CSS and the JavaScript for performing certain tasks.
Syntax
<tag id = "Value" >
Example
<!DOCTYPE>
<html>
<title>HTML Tutorials</title>
<head>
<style>
#prog {
background-color: lightgreen;
color: white;
padding: 10px;
}
</style>
</head>
<body>
<h2>Example of Id attribute in CSS </h2>
<p>The correct place for easy learning.....</p>
<h2 id="prog">C Programming</h2>
<h2 id="prog">HTML</h2>
<h2 id="prog">CSS</h2>
</body>
</html>
Output
No comments:
Post a Comment