Hi ankur218. Classes and IDs are both hooks for CSS styling. That is, if you put either on an element, you can then style that element by targeting the class or ID. In a way, it doesn't matter much which you use, but be aware of a few things:
- you can only use the same ID once per page, while you can re-use a class on a single page as many times as you like
- an ID 'carries more weight' than a class, which can be good or bad. This is an issue of specificity
- you can place multiple classes on an element (very handy) whereas you can only have one ID per element.
Also, IDs are handy for a few other things, such as:
- same-page links. (You can reference an ID in a link and the browser will jump to the element with that ID)
Hope that helps.