- 1
Why we can use same id to different elements in html
like <p id="navbar'> ------ ---- some code.. <\p> <p id="navbar"> --------some code <\p>
2 Answers
+ 3
As you might already know HTML is a markup language and nothing prevent you to type anything you want. The web browser engine will try its best to render it with respect to the DOCTYPE.
So what you're doing is entirely possible but you're digging a hole for yourself as id attribute is global and meant to be *unique*.
0
I realised that it's an invalid expression but still we can use it and it works, but I want to know that what possibly could happen if I use it all over my code instead of classes.