Which of the following is the main difference between an ID and a class?
Which of the following is the main difference between an ID and a class?
a. Classes are for use with spans and IDs are for use with DIVs
b. IDs are supposed to be only used once per page but Classes can be used multiple times per page, and one element can have more than one Class but should have only one ID
c. IDs are better than Classes
d. None of the above
b. IDs are supposed to be only used once per page but Classes can be used multiple times per page, and one element can have more than one Class but should have only one ID
Explanation: The main difference between ID and class is that ID can be used only once in a web page but a class can be used multiple times. Moreover, an element can also have multiple classes but it can only have a single ID.