+ 12

What is the difference between id and class?

understand and know how to use

4th Aug 2017, 12:41 PM
felix
felix - avatar
12 ответов
+ 18
Don't think you could get a link better than this one : https://css-tricks.com/the-difference-between-id-and-class/
4th Aug 2017, 12:50 PM
Dev
Dev - avatar
+ 10
the classe defines a set of elementi whit common features,with the ID Boeing defined as a unique element .
4th Aug 2017, 1:42 PM
feliciano
feliciano - avatar
+ 5
id can only be used once
4th Aug 2017, 12:59 PM
Martin Ed
Martin Ed - avatar
+ 4
An element can have multiple class but multiple id, id are to differentiate an element from all others
4th Aug 2017, 1:11 PM
LordGhostX
LordGhostX - avatar
+ 4
still not very clear, need more explanations perhaps I should come back after visiting link provided by dayve
4th Aug 2017, 6:31 PM
Vivek Singh
Vivek Singh - avatar
+ 4
an id is related to only one html element ..so when you apply css styles on that id ..only the specific element will be affected..while class can be used by any element even from different type in order to reduce repetition of code
4th Aug 2017, 11:44 PM
SyrianVikings
SyrianVikings - avatar
+ 3
id and class using in css, we using . operator and # operator
10th Sep 2017, 6:40 PM
Abhishek Shukla
Abhishek Shukla - avatar
+ 2
to me I think id and class are almost the same, both does the same work. but when representing it in the CSS sheet is different the id makes use of "#" at the beginning while class doesn't make use of "#". for example: <p class="one"> I am a boy </p> one. { color:blue; } <p Id=" two"> I am a boy </p> #two { color:green; }
17th Jan 2018, 7:29 AM
Adeyemi emmanuel
Adeyemi emmanuel - avatar
+ 1
Id is only for specifying one element whereas class can specify multiple elements.
16th Aug 2017, 3:16 PM
John
John - avatar
+ 1
to me I think id and class are almost the same, both does the same work. but when representing it in the CSS sheet is different the id makes use of "#" at the beginning while class doesn't make use of "#". for example: <p class="one"> I am a boy </p> one. { color:blue; } <p Id=" two"> I am a boy </p> #two { color:green; }
17th Jan 2018, 7:29 AM
Adeyemi emmanuel
Adeyemi emmanuel - avatar
+ 1
ID can only be used once while class can be used anywhere
3rd Mar 2018, 6:26 PM
Kehinde Fagbayibo
Kehinde Fagbayibo - avatar
0
Id only use one time in one page but we use class many times
12th Jul 2018, 8:27 AM
Vijayshree Saini