
Shobha
The best way to predict the future is to invent it
What is the difference between id and class selectors in CSS?
An ID selector targets a single, unique element on the page and must be used only once, whereas a class selector can be assigned to multiple elements across the page. The ID selector is more specific and overrides class selectors in case of conflicts.
For example,
#primary { color: blue; } /* Targets an element with the id 'primary' */
.button { color: red; } /* Can be used on multiple elements with the class 'button' */
For example,
#primary { color: blue; } /* Targets an element with the id 'primary' */
.button { color: red; } /* Can be used on multiple elements with the class 'button' */