id vs class what different? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

id vs class what different?

15th Sep 2016, 7:56 AM
Xerxes
5 Answers
+ 3
An id has to be unique. An element may have several classes, and several elements may belong to the same class.
15th Sep 2016, 8:24 AM
Zen
Zen - avatar
+ 1
There Can Many Differences In It Like : id Are Unique and Applied To Any Specific Element But Class Can Be Applied Any No Of Element. In CSS id Styling Starts With Pound Sign (#) But Class Styling Starts With Dot(.) Sign.
12th Oct 2016, 7:51 PM
PIYUSH KUMAR
0
id is unique class can be use by a lot element
18th Sep 2016, 5:36 PM
Quoc Trung Ho
Quoc Trung Ho - avatar
0
plus when referring to id you us # sign but for class you us . (dot)
19th Sep 2016, 12:19 PM
Solomon Kiarie Mwangi
Solomon Kiarie Mwangi - avatar
0
Id attribute is used as a hook in html file for individual styling of elements . Although Id attribute can be used in as many elements as required but no two elemen's Id can have the same value . In css #idName is the selector syntax to style a particular element using its I'd name. Class attribute is just like Id but unlike Id , multiple elements can have the same class value, and it is generally used to style a group of elements.I n css .className is the correct selector syntax to style a group of elements having the same class value.
19th Sep 2016, 8:14 PM
Abhinava Sanyal
Abhinava Sanyal - avatar