Meherwan Gill Meherwan Gill - 10 months ago 43
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

tag instead of
tag? I mean since
covers everything
does and more.

Answer Source

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.