Q. What attribute can be added to many HTML/XHTML elements to identify them as a member of a specific group?
β
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>
<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>