0
What is the difference between p tag and div tag what is need to use div tag??
3 Réponses
+ 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
+ 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
+ 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.