+ 1

difference between id and class

the tutorial mentioned that an id can only be used once in a page unlike a class , I don't understand this exactly cause I've used ids alot and no errors came up ... or so I think

24th Aug 2016, 5:56 AM
KEILLY NYAGOWA
KEILLY NYAGOWA - avatar
2 Respostas
+ 2
I think it's more you can't have the same two id's on one page. Because the id defines one thing where as the class defines everything using that class. At least that's how I interpreted it. Not sure if that helps
24th Aug 2016, 1:12 PM
Chasity Melnick
Chasity Melnick - avatar
0
# is id and . is class for exampel #body{ text-align: center; color: black; background-color: #FFFFFF; } <div id="body"> This text </div> this is div id exampel
27th Aug 2016, 3:49 AM
vinay
vinay - avatar