+ 1
A big doubt with HTML/CSS..
I am facing this, there is the rule of HTML/CSS that we can not use same id for different HTML tags or documents...But if try to do it then why it's working as class? And where is the applies that we can't use an CSS id for multiple tags or documents? Kindly solve my doubt! Thank you..
4 odpowiedzi
+ 4
You can use one id or class for multiple tags.
But u have do that only when ur gonna design or style them in a same way.
If u want to style them in different ways then you have to use different id's or classes
Hope u understood.
😊
+ 2
Id with same name will still work but only for the first element
+ 2
And If you try with js :
that document.getElementById() returns a single first element but with document.getElementByClass return an array of elements...
So again here you miss 2nd,... dublicate ids..
So use class for a group of similar styling and for a unique different styling in a document use id.
+ 2
Yes I got it, thnx for your reply :)