+ 3

what is the difference between <div> tag and p tag in the html ?

Html is the programming language.

5th Sep 2021, 11:09 AM
Shubham Bhatia
Shubham Bhatia - avatar
5 Answers
+ 5
P tag is for paragraph ,especially text. I don't see special meaning of div.(may be b.coz of I am a newbie) We usually use div for grouping element.And div can swap p But p can't swap div Div can be nested and p can't There may be other differences.
5th Sep 2021, 11:23 AM
Myo Thuzar
Myo Thuzar - avatar
+ 3
The difference is semantics (the meaning of the word) <p> = paragraph Semantic element because it's used for paragraphs Contains paragraph content (text) Is a Block element Can be put inside aĀ <div>Ā element <div> = division Not semantic element because it does not divide (maybe very very little - depending who you ask) ItĀ ContainsĀ orĀ Wraps.Ā Therefore; Is aĀ Container of DataĀ because it can contain many elementsĀ ORĀ you could say itĀ ā€˜Wraps’ other elements (as in wraps around them) Is a Block element You can put <p> inside <div> You cannot put <div> inside <p> Hope this helps Learn more: https://www.quora.com/What-is-the-difference-between-a-p-tag-and-a-div-tag
5th Sep 2021, 11:19 AM
Ferdous šŸ‘¾
Ferdous šŸ‘¾ - avatar
+ 3
P is use for Paragraphs Div is use for grouping elements.
6th Sep 2021, 11:23 AM
Bharat Bhushan
Bharat Bhushan - avatar
+ 2
P is used as a paragraph While div is used as a container for other elements
5th Sep 2021, 11:19 AM
Pro Professor
Pro Professor - avatar
+ 1
They haveĀ semanticĀ difference - aĀ <div>Ā element is designed to describe a container of data whereas aĀ <p>Ā element is designed to describe a paragraph of content. The semantics make all the difference. HTML is a markup language which means that it is designed to "mark up" content in a way that is meaningful to the consumer of the markup. Most developers believe that the semantics of the document are the default styles and rendering that browsers apply to these elements but that is not the case.
6th Sep 2021, 4:32 AM
Arun Jamson
Arun Jamson - avatar