When do you use "id" and "class"? In other words, which tags should I include the above? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When do you use "id" and "class"? In other words, which tags should I include the above?

28th Jul 2018, 3:05 PM
Rashid
Rashid - avatar
4 Answers
+ 3
Id can be used to identify one element, whereas a class can be used to identify more than one.
28th Jul 2018, 4:49 PM
Prateek
Prateek  - avatar
+ 3
Id represents as #idname Class represents as . classname
28th Jul 2018, 4:50 PM
Prateek
Prateek  - avatar
+ 2
「HAPPY TO HELP」 I'd like to add onto your answer by saying that IDs have a higher precedence than classes.
28th Jul 2018, 8:31 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
any body online, please?
28th Jul 2018, 3:30 PM
Rashid
Rashid - avatar