+ 3

What do they mean when they say id attribute is unique and can only be used once?

*To make the question clearer Distinguish the one which is correct : And please explain why the other one is wrong! https://code.sololearn.com/WubzbGHUgZ3Z/?ref=app https://code.sololearn.com/WiXzc7200eZh/?ref=app

12th Aug 2017, 11:01 AM
Eyob G. Hagos
Eyob G. Hagos - avatar
4 Réponses
+ 7
choice A is wrong, use class instead choice B is correct
12th Aug 2017, 12:54 PM
Amethyst Animion
Amethyst Animion - avatar
+ 7
to see the difference, try use this CSS syntax use this CSS syntax in choice A: #paragraph1 { color: red; } use this CSS syntax in choice B: #paragraph1 { color: red; } #paragraph2 { color: red; }
12th Aug 2017, 12:59 PM
Amethyst Animion
Amethyst Animion - avatar
+ 6
a simple explaining id must unique: think if id is yourself in this world, only one and different from others. id can only be used once: think if id is a number, because number only seen once if you write the numbers from 0 to infinity,
12th Aug 2017, 11:22 AM
Amethyst Animion
Amethyst Animion - avatar
+ 2
If id is unique and can't be used more than once in a document why do we use it then, why not just use class???
12th Aug 2017, 12:01 PM
Eyob G. Hagos
Eyob G. Hagos - avatar