Meherwan Gill Meherwan Gill - 25 days ago 6
HTML Question

Is there any reason for using <p> tag instead of <pre> tag in html

I am a beginner in HTML and haven't started learning CSS yet. Is there any reason where one would prefer to use

<p>
tag instead of
<pre>
tag? I mean since
<pre>
covers everything
<p>
does and more.

Answer

I would use <p> for paragraphs and <pre> for pre-formatted text.

They are nothing like each other other than sharing the first letter :-)

From those links:

A paragraph is typically a run of phrasing content that forms a block of text with one or more sentences that discuss a particular topic, as in typography, but can also be used for more general thematic grouping. For instance, an address is also a paragraph, as is a part of a form, a byline, or a stanza in a poem.

The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements.