- 1
Pls explain atr. DIV and CLASS for html?
I want to understand for good DIV and CLASS in html. someone can explain? thx
2 odpowiedzi
+ 3
A div is something you can use to enclose HTML so it's all in one manageable space. This is really useful for group styling, when used with classes (explained below).
Example:
<style>
.test { # the "." is used to access classes in css
color: red;
}
</style>
<div class = "test">
<p>Hi there!</p>
<p>Why hello!</p>
</div>
With the code above, both p tags will be red.
Classes are essentially ids that you can give HTML tags, making them easy to find in CSS, JavaScript, etc. They are useful for, once again, group styling, as shown above.
Happy coding! 😁
+ 1
htx man. Good answer. Now is more clear