0

What is the difference between p tag and div tag what is need to use div tag??

24th Dec 2017, 4:49 PM
kanthraj s
kanthraj s - avatar
3 Answers
+ 1
Remember a lot of HTML is semantic, the tag represents the purpose of the information it contains. So p and div are both block level elements, and in most cases would be indistinguishable visually, but semantically we use div to contain a group of related things, and p for text (as an example). For me, this is one of the most important things to remember about the various tags
24th Dec 2017, 11:52 PM
Dan Walker
Dan Walker - avatar
+ 5
To make things simple. P means Paragraph, meaning it's when you want to write something. Div means divide, this contains other elements underneath it and is usually styled by id or class in css
27th Dec 2017, 4:20 PM
Derek Leiro
Derek Leiro - avatar
+ 2
1. p tag is used for paragraph. 2. div tag is used as a container of other elements (in order to style them the same way with CSS), including p element.
24th Dec 2017, 5:16 PM
Ledio Deda
Ledio Deda - avatar