Can a <div> have ID & CLASS Attribute?
Yes, In HTML we can use ID and Class both attributes together in a <div> for the uses of CSS properties.
1. Using a Class
.demo {
padding:10px;
height: 200px;
width: 400px;
}
For Example
<div class="demo">
<p>This is the first paragraph.</p>
</div>
2. Using an ID
#demo_ID {
top-margin:40px;
}
For Example
<div id="demo_ID">
<p>This is the first paragraph.</p>
</div>