0

What is the difference between id and class in html

I need a human's explanation

4th Aug 2021, 11:35 AM
Philippe Ezekiel
Philippe Ezekiel - avatar
4 Answers
+ 4
Firstly class is what is mostly used by CSS/Bootstrap to style the html Now you can also use id too But not as popular as using class Now the main difference is class can be used fo target more than one element in html but an Id can only target one element , Just take your Id like your phone number It can only be for one person But class isnt unique
4th Aug 2021, 12:05 PM
Fatoki Temiloluwa
+ 1
You can have multiple elements with the same class but diffrent ids.
4th Aug 2021, 12:04 PM
Anthony Johnson
Anthony Johnson - avatar
+ 1
Fatoki Temiloluwa really like your example
4th Aug 2021, 8:57 PM
Philippe Ezekiel
Philippe Ezekiel - avatar