0
What is the difference between id and class attribute???
please explain with examples
4 odpowiedzi
+ 1
Id is unique, it means that it can't be duplicated.
Unlike Id, Class can be duplicated in all your other tags/elements.
For example you have:
<div class="myClass yourClass" id="myId"></div>,
you can still use either myClass or yourClass in your other <div>'s but you can't use it's id to your other <div>'s .
0
when I declared both in same tag what happens??
0
well if you do that, your tag will have an id and class attribute. but if you do that you must not let the value of it's id be the same with the value of it's class.