What's the differance between id and class in css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the differance between id and class in css?

1st Aug 2016, 10:59 PM
ahmed mohamed mohamed mohamed marzook
ahmed mohamed mohamed mohamed marzook - avatar
3 Answers
+ 2
id is unique,you cant have two elements with same id,while you can have as much as you want elements with the same class.In the css classes are defined with . and ids with #
3rd Aug 2016, 5:47 AM
Божидар Димитров
Божидар Димитров - avatar
+ 1
I think they can be used similarly in CSS but I'm pretty sure the id is like your name, which is unique to each individual property, class is like your class in school, you can have several Id's in one class.
2nd Aug 2016, 12:51 PM
Chris
Chris  - avatar
0
good answer id not to all but to one class to one , two ,three .....element or all elements
2nd Aug 2016, 1:15 PM
ahmed mohamed mohamed mohamed marzook
ahmed mohamed mohamed mohamed marzook - avatar