What is the main difference between <div> and <class> in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the main difference between <div> and <class> in HTML?

1st Dec 2017, 6:13 AM
Jaydip Thakkar
Jaydip Thakkar - avatar
2 Answers
+ 5
There exists no element as <class>, but there is a global attribute class which is used to apply the same style to a group of elements. On the other hand, the <div> element is a container for other elements. It's like a body within <body> and is generally used to define a division or section in a web page.
1st Dec 2017, 6:21 AM
DAB
DAB - avatar
+ 5
Use div tag, there is no class tag.
1st Dec 2017, 6:39 AM
Calviղ
Calviղ - avatar