+ 3
what is the difference between <div> tag and p tag in the html ?
Html is the programming language.
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.
+ 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
+ 3
P is use for Paragraphs
Div is use for grouping elements.
+ 2
P is used as a paragraph
While div is used as a container for other elements
+ 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.