What is difference between id and class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between id and class?

4th Sep 2017, 12:58 PM
Pinkcoder
Pinkcoder - avatar
4 Answers
+ 2
https://css-tricks.com/the-difference-between-id-and-class/?_e_pi_=7%2CPAGE_ID10%2C6602713746
4th Sep 2017, 1:15 PM
Isomer
Isomer - avatar
+ 2
id and class is related for CSS and JavaScript. in my opinion "id" means identity, it is unique. So if you have give id to one html element then you can't name other element with same id with the first one. Meanwhile class is different, "class" is like classification, or you can imagine it like classroom. In classroom there are students (in this case html elements), more than one students is inside same class. calling one class will call all the students (html element) inside. Hope answered your question.
4th Sep 2017, 1:46 PM
Vico Arnanta Sasmita
Vico Arnanta Sasmita - avatar
+ 1
this also helped me.... thanks
4th Sep 2017, 6:57 PM
Okoro Ikechukwu Stephen
Okoro Ikechukwu Stephen - avatar