Classes and ID's | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Classes and ID's

When should I use a "class" and when should I use"id"?

19th Nov 2016, 4:38 PM
Sidepocket
Sidepocket - avatar
1 Answer
+ 2
they can be used in place of others but id are meant to be given to uniquely identify elements be it pointing them in scripts like javascript or using links or applying specific styles . on the other hand, classes are meant to be given to many elements which require same style for example, you can place several buttons the ok button cancel button next etc. there we generally use id different and unique but will give same class to style button.
19th Nov 2016, 6:25 PM
Sandeep Chatterjee