+ 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 odpowiedzi
+ 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
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - 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