<p> and <pre> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

<p> and <pre>

What is the different between <p> and <pre>?

7th Mar 2021, 6:22 AM
Destin Smith
3 Answers
+ 4
p defines a paragraph which don’t preserve line spaces ex: <p> Hello World </p> output: Hello World (single line) pre defines pre formatted text which preserves line spaces ex: <pre> Hello World </pre> output: Hello World (double line)
7th Mar 2021, 6:28 AM
Sharique Khan
Sharique Khan - avatar
+ 3
<p> ignores extra whitespaces <pre> preserves whitespaces
7th Mar 2021, 6:28 AM
TOLUENE
TOLUENE - avatar
+ 3
Newlines entered are preserved in <pre> tags.
7th Mar 2021, 10:43 AM
Sonic
Sonic - avatar