Pls explain atr. DIV and CLASS for html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Pls explain atr. DIV and CLASS for html?

I want to understand for good DIV and CLASS in html. someone can explain? thx

8th Oct 2017, 12:12 AM
BOGDAN Sarbu
BOGDAN Sarbu - avatar
2 Answers
+ 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! 😁
8th Oct 2017, 3:14 AM
LunarCoffee
LunarCoffee - avatar
+ 1
htx man. Good answer. Now is more clear
8th Oct 2017, 4:35 PM
BOGDAN Sarbu
BOGDAN Sarbu - avatar