0
Why I can't use id more than once and shoulf I use Id or class and Can I use id in different html?
2 Respuestas
+ 2
Like your ID card be unique, id attribute of elements are also expected to be unique. While class attribute can be applied for multiple elements where they all share some things in common, e.g. same setup of colours, font, position etc.
You can use same id for multiple elements even in the same HTML file, but it makes no sense, as by that you will be violating the uniqueness concept. When you learn Javascript you will understand better about id and class.
You can use same id or class in different HTML files, just be sure the respective CSS rules are there too.