+ 3

What is the diffrens bettwen getting style in css by id and by class

29th Jul 2018, 7:53 PM
Ogur4ek
Ogur4ek - avatar
7 Answers
+ 8
Thare is no difference when using them For example if you have an id on on a paragraph <p> called “text1” and a class on the same tag called “text2” there will be no difference However the only difference is the way you call them: For id: Use - # #text1 { } For class: Use - . .text2 { } Note - id’s are unique, therefore can only be used once in html element. - classes can be used as many times as you wish on an element
29th Jul 2018, 8:04 PM
Agent
Agent - avatar
+ 3
thanks:3
29th Jul 2018, 8:05 PM
Ogur4ek
Ogur4ek - avatar
0
Also, the styling by ID will replace the styling by class, if there are any clashes -- the most specific selector is chosen.
29th Jul 2018, 9:22 PM
James
James - avatar
0
Classes can be shared used as many times as you need while ids are unique and can be used only once. Class and ID are kind of self-explanatory keywords.
30th Jul 2018, 12:45 AM
Sergej Skye Tolones
Sergej Skye Tolones - avatar
0
https://code.sololearn.com/W7sflPVjJY8z/?ref=app they realy are same:3 no repeats
30th Jul 2018, 5:17 AM
Ogur4ek
Ogur4ek - avatar
0
https://www.sololearn.com/Discuss/1425768/?ref=app Hope this helps â˜șâ˜ș.
30th Jul 2018, 5:18 AM
Meet Mehta
Meet Mehta - avatar
0
Briefly, id style used for one unique item only, where the class style can be used many times as you like (reusability).
30th Jul 2018, 1:45 PM
ADIL GAAFER
ADIL GAAFER - avatar