0
what are div, classes,id ??
i began today to learn css but I'm confused. I understood div is a container of other elements but I don't know the difference between class and id and I don't know how this change the css style of a web page
2 odpowiedzi
+ 2
The benefit of this is that you can have the same HTML element, but present it differently depending on its class or ID. In the CSS, a class selector is a name preceded by a full stop (“.”) and an ID selector is a name preceded by a hash character (“#”).
+ 2
1-You can use class any time and any where you want...but you must use id once
2-with class , you can select many tags , but with id , you can select needle in a hystack ((Select A Tag In Hundreds Tags))
3-ID is more specific than Class , ID Has 100 score and class is 10
Example:
HTML:
<p class="color" id="color" > ID Is More Specific</p>
CSS:
#color { color: red; }
.color { color: blue; }
So The Paragraph Will Be Red , Because ID Has 90 Score More Than Class