I have heard that ID is unique and can only be used once in a page, but its working fine when used over multiple times on a page. Please let me know the purpose of ID and hows i
I have heard that ID is unique and can only be used once in a page
That is an HTML rule and has nothing to do with CSS.
but its working fine when used over multiple times on a page.
Browsers perform error recovery. Don't depend on it as not all browsers will recover from all errors in the same way. Write valid markup.
Please let me know the purpose of ID and hows its exactly different from classes?
In HTML terms — an id is unique per document and can be a link target. A class can be reused.
In CSS terms — An id selector has a higher specificity than a class selector.