Lecture

Difference Between Span and P Tags

The <span> tag and the <p> tag are both used when dealing with text.

The main difference between these two tags is that the <p> tag places text on a new line for each use, while the <span> tag allows text to remain on the same line with other elements.

Using the <p> tag will automatically position text on a new line each time it's used.

However, the <span> tag will keep text inline, even when used multiple times.

Example of span Tag
<span>Hello</span> <span>Nice to meet you</span>

In the above code, "Hello" and "Nice to meet you" will be displayed on the same line.


On the other hand, the <p> tag positions text on a new line each time it is used.

Example of p Tag
<p>Hello</p> <p>Nice to meet you</p>

In this example, "Hello" and "Nice to meet you" will each be on separate lines.

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help