ID&Classes

+2 Aviv Bahar · July 23, 2015
What is the difference between ID's and classes?
apart of the signs ;)

Post a Reply

Replies

Oldest  Newest  Rating
0 Aviv Bahar · July 24, 2015
Thanks everybody! :)
0 Superman HC · July 24, 2015
ID's are pretty much more unique identifier... class can be made generic..

For example:
<p class = "bucky"
<button class = "bucky"
u need to write one css code for class bucky and both para and button works in the same way...
ID's can't be same in one program as this will lead to error... the ID's have to be different.

U can learn this by using an analogy that I used..
two students can belong to the same class and both of them are supposed to do same assignments..
but the identification no, or the roll no. of each student has to be different...
Hope this helps :)
+1 Abdullah Nauman · July 23, 2015
It basically just programming practice. If a specific styling will be used in more than one element, it is recommend to use a class. If it will only be referenced once in the html, then an ID is good practice. Functionally both are identical.
  • 1

HTML / CSS / Web Design

107,235 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators