If id is unique and can't be used more than once in a document why do we use it, why not just use class??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If id is unique and can't be used more than once in a document why do we use it, why not just use class???

24th Dec 2017, 3:50 PM
Eyob G. Hagos
Eyob G. Hagos - avatar
3 Answers
+ 3
Because there are singular elements you want to style only once, plus it is useful when you want to locate a certain p or div tag when you are using Javascript
24th Dec 2017, 4:13 PM
Tarantino
Tarantino - avatar
+ 1
You may want to style a single section @Eyob
28th Dec 2017, 3:24 PM
Samuel Haile
0
@Sami we can use class to style a single section!
14th Jan 2018, 8:27 AM
Eyob G. Hagos
Eyob G. Hagos - avatar