Hi, what is difference between id and class? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

Hi, what is difference between id and class?

26th Jan 2017, 6:03 PM
ehsan shahbazi
ehsan shahbazi - avatar
5 Réponses
+ 5
hi, id must be unique, class could be reused
26th Jan 2017, 6:07 PM
R4xx4r
R4xx4r - avatar
+ 4
@shashi prakash: <a href="#me"> ... with hashtag sign ( # ) it's better ;)
27th Jan 2017, 4:38 AM
visph
visph - avatar
+ 2
@visph Sorry i mistyped there. yes it's with hash tag.
27th Jan 2017, 7:03 AM
shashi prakash
shashi prakash - avatar
+ 1
as visph said, to link to an id the uri must be #idname Classes can be scrolled to/linked to using javascript Both classes and id can be used to style. Custom attributes as of HTML5 can also be used and linked to.
27th Jan 2017, 5:18 AM
Louis Milotte
Louis Milotte - avatar
0
ID can be used for linking. Class is only used for styling. Examples - <div id=me class=you> in HTML You can use id i.e me for linking. <a href="me">
26th Jan 2017, 7:14 PM
shashi prakash
shashi prakash - avatar