What is the difference between DIV, SPAN and paragraph tag in HTML?

All three are used to hold content, but they are different.

TagTypeUse
<div>BlockGeneric container to group sections and for layout
<span>InlineGeneric container to style a small part of text
<p>BlockA paragraph of text, with a meaning
<div class="card">
  <p>My favourite colour is <span style="color:red">red</span>.</p>
</div>
Output in the browser

My favourite colour is red.

div and span have no meaning of their own, while p tells that the text is a paragraph. See HTML Div and Span.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.