The . is the element that contains class="" ... When we use class="" in HTML then in CSS we call the element with . (point), example:
HTML
<div class="fundo-vermelho">Aqui vai ser um fundo vermelho colocado via class</div>
CSS
.fundo-vermelho{
background:red;
}
With # (fence/tic game) is the same only thing that applies to ID. When in HTML we use id so in CSS we use #
HTML
<div id="fundo-azul">Aqui vai ser um fundo azul colocado via ID</div>
CSS
.fundo-azul{
background:blue;
}
When we use 2 elements following as E1 E2 means that we will apply the CSS command inside the element E2 that’s inside E1
HTML
<div class="box">
<div class="conteudo">
Esse é o conteúdo
</div>
</div>
CSS
.box .conteudo{
font-weight:bold;
background:pink
}
When we separate the element by comma, it means that the styles we are applying to one we apply also to the other
HTML
<div id="elemento1">Elemento 1</div>
<div class="elemento2">Elemento 2</div>
<div id="elemento3">Elemento 3</div>
CSS
#elemento1, .elemento2, #elemento3{
background:red;
}
When using the element * then we will apply all the style to all elements within the element
When we don’t use . or # we only define the name of the element then it can only be that the style is attributed to tags
HTML
<a href="">Aqui vai ser um fundo vermelho colocado via class</a>
CSS
a{
background:purple;
}
And when we use something like :Hover (pseudo-elements) are to apply the style to specified parts of the element. I’ll give an example of the link (<a>
)
HTML
<a href="" id="meu-link">Passe o mouse aqui</a>
CSS
#meu-link:hover{
background:red;
}
Pseudo-elements are specific items, that is, it cannot be any name.
Sensational your explanation, thank you.
– Roknauta