Class, ID | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Class, ID

What is diffrens betwen class and ID?

23rd Jul 2018, 2:24 PM
Kalaba
Kalaba - avatar
2 Answers
+ 11
Classes are NOT unique. You can use the same class on multiple elements. You can use multiple classes on the same element.a class selector is a name preceded by a full stop (“.”) and an ID selector is a name preceded by a hash character (“#”). The difference between an ID and a class is that an ID can be used to identify one element, whereas a class can be used to identify more than one. for more information https://www.quora.com/What-is-the-difference-between-class-and-id-in-HTML
23rd Jul 2018, 2:36 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
So i can use more then one class etc. <h1 class=".green" ".red"> but i can use only one id etc. <h1 id="#green"> and class can have in it color and position of green but id can only have color or only position.Am i right?
23rd Jul 2018, 2:58 PM
Kalaba
Kalaba - avatar