+ 1

What is the difference between ID and CLASS?

Someone plz explain in details.

1st Mar 2019, 6:10 AM
আসাদুজ্জামান সবুজ
আসাদুজ্জামান সবুজ - avatar
4 odpowiedzi
+ 7
ID should identify a single element with a unique label. Something that you have only one in the html code, like a menu bar. CLASS can refer to a group of tags that share common properties. Example: table cell, or paragraph.
1st Mar 2019, 6:27 AM
Tibor Santa
Tibor Santa - avatar
+ 5
id also has higher priority than class.
1st Mar 2019, 7:06 AM
Toni Isotalo
Toni Isotalo - avatar
+ 2
Id must be unique Class must not be unique you can give the same class for many different tags But you can't give the same id for many tags
1st Mar 2019, 6:36 AM
estifanos
estifanos - avatar
0
id is used for specific element and class is used more than once id has more preference than class
14th Mar 2019, 8:59 PM
zubAyr Alee
zubAyr Alee - avatar