The #id selector is used to select the element with a specific id attribute. The value of this attribute is the element's unique identifier. The class selector style apply on multiple elemnets but id selector style apply on unique element.
ID Syntax
You declare a CSS id by using a dot (#) followed by the id name. You make up the id name by yourself. After the id name you simply enter the properties/values that you want to assign to your id.
Syntax-
selectorID{
property:value;
}
Example of Code
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of ID selector</title>
<style>
#css-id-selector-heading{
color:red;
height:100px;
}
</style>
</head>
<body>
<h1 id="css-id-selector-heading">This is a heading</h1>
<p>This is another paragraph.</p>
</body>
</html>
Output
Example of ID selector This is a heading
This is another paragraph.
