Q. What attribute can be added to many HTML/XHTML elements to identify them as a member of a specific group?

  • (A) Id
  • (B) class
  • (C) div
  • (D) span
πŸ’¬ Discuss
βœ… Correct Answer: (B) class
Explanation: A class is used to identify several elements, and its name is preceded by a dot (.). Example:
<html>
<head>
<style>
.city {
background-color: blue;
color: yellow;
}
</style>
</head>
<body>
<p class="city">London is the capital of England.</p>
<p class="city">Paris is the capital of France.</p>
<p class="city">Tokyo is the capital of Japan.</p>
<p class="city">Rabat is the capital of Morocco.</p>
</body>
</html>
Explanation by: Tanmay
A class is used to identify several elements, and its name is preceded by a dot (.). Example:
<html>
<head>
<style>
.city {
background-color: blue;
color: yellow;
}
</style>
</head>
<body>
<p class="city">London is the capital of England.</p>
<p class="city">Paris is the capital of France.</p>
<p class="city">Tokyo is the capital of Japan.</p>
<p class="city">Rabat is the capital of Morocco.</p>
</body>
</html>

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
211
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Tanmay
Publisher
πŸ“ˆ
84%
Success Rate