Answer
An HTML document can have multiple elements having the same class
value, but cannot have multiple elements having the same id
value.
So, elements can share class value, but cannot share id value as it must be unique in an HTML document.
Example
<!DOCTYPE html>
<html>
<head>
<style>
.center { text-align: center; }
</style>
</head>
<body>
<h1>HTML Attributes: class and id</h1>
<p class="center" id="para1">Paragraph text one.</p>
<p class="center" id="para2">Paragraph text two.</p>
</body>
</html>
In the below example, we have two paragraphs using the same class
value but using different id
values.