class="Son tus caracteríticas como persona, medio económicos, etc"
id="Es tu identidad, de esa manera te pueden identificar a traves de tu Cedula/NIT donde quieras que lo soliciten"
Many people can belong to the same class and have similar conditions, but no one can have the same id=""and in case two people have the same, id=""both would have problems with the law if one of them is at the wrong time and place.
It also works in html, suppose I want the same one class=""for all my forms, then in CSS I define that class="mis formularios"all the blue letters have it, now, I need form 1 to be in one place and form 2 in another place, it is there Where does it come from id=""? I must identify each element of each form with different names because, despite the fact that they have the same name, they class=""are two independent elements and I do not want what I do with one to affect the other, such as when saving the data in a database. of data.
the class attribute helps you bind a CSS style (which defines the look of that element, and all other elements you apply that CSS to). For example:
And the id attribute allows you to uniquely identify that element throughout the document for later use, either with CSS or javascript.
The "id" must not be repeated in the same document or unexpected behavior will occur.
In short, with an id you act directly on the element you want and with class you can act massively on all the elements that use that class.
Literally or with an analogy I explain it to you:
Many people can belong to the same class and have similar conditions, but no one can have the same
id=""
and in case two people have the same,id=""
both would have problems with the law if one of them is at the wrong time and place.It also works in html, suppose I want the same one
class=""
for all my forms, then in CSS I define thatclass="mis formularios"
all the blue letters have it, now, I need form 1 to be in one place and form 2 in another place, it is there Where does it come fromid=""
? I must identify each element of each form with different names because, despite the fact that they have the same name, theyclass=""
are two independent elements and I do not want what I do with one to affect the other, such as when saving the data in a database. of data.