CSS - Classe, ID e Span
What is the difference between CLASS and ID?
In HTML and CSS, there is the possibility of applying styles through "class" and "id" and, in JavaScript, it is possible to identify some element of a page by its class, id or tag. But what is the difference between "class" and "id"?
Class : are a way to identify a group of elements. Through them, you can assign formatting to SEVERAL elements at once.
ID : The ids are a way to identify an element, and they must be UNIQUE for each element. It is as if they were fingerprints of our fingers or IDs. Through them, you can assign formatting to a particular element.
Span :
Here are some examples of HTML styling:
div1
div2
Simple paragraph.HTML code:
x
<p>Simple paragraph.</p>
CSS code:
x
#div1{
color : #fff000;
}
.classdivs{
color : #000000;
}
color : #fff000;
}
.classdivs{
color : #000000;
}