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

What is the difference between <div> and <p>?

3rd Aug 2020, 3:12 AM
Ariel
Ariel - avatar
2 Answers
+ 2
<p> is specifically used when writing a paragraph. meaning that it indicates a paragraph and has semantic meaning while <div> is also known as division. Basically a block container for other content. Usually used when defining a section or division in html doc or can also group block-elements to format them with css.
3rd Aug 2020, 3:22 AM
Mina
Mina - avatar
+ 1
P is textual tag it is use to write text .div can also be used for texting.but Div is basically an structure tag.before HTML5 when we don't have semantic tag (header,footer,article ,aside,....) .in html we use div to structure webpages.it can act as container for various element. Now in html5 we use it as both for structure and text mostly hence it looks similar to p.
3rd Aug 2020, 3:39 AM
Divya Mohan
Divya Mohan - avatar