I am new in web developing and I am trying to design a website for learning html and css. But I noticed that when I set any id to an element and then write the css for that id, then it is applied on that element, and when I set class and do the same with that class, then also css is applied on that element.

So I wonder is there any difference in ID and CLASS or not ?

And if no, then why these both are developed.

Thank you