Pre tag is used for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Pre tag is used for?

8th Sep 2020, 1:14 PM
Sonu Kumar Kushwaha
Sonu Kumar Kushwaha - avatar
4 Answers
+ 5
If you want everycharacter(spaces,linebreaks , text as you have write in code you should use pre tag. Ex- <pre>this Is Pre</pre> Result:- this Is Pre If you write <p>this Is Pre</p> Result:- this is pre So pre tag preserve you spaces and line break in result as you have done in code.
8th Sep 2020, 5:01 PM
Divya Mohan
Divya Mohan - avatar
+ 7
` The HTML <pre> tag is used for indicating preformatted text. The code tag surrounds the code being marked up. Browsers normally render pre text in a fixed-pitched font, with whitespace in tact, and without word wrap. ` From https://www.tutorialspoint.com/html/html_pre_tag.htm
8th Sep 2020, 4:12 PM
Nilesh
+ 7
Pre tag is used for preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line breaks. Also see this link it will help you. https://www.w3schools.com/tags/tag_pre.asp
8th Sep 2020, 4:40 PM
Ansheeta
Ansheeta - avatar
+ 4
If you want to use whitespace and line breaks in your web page then you can use <pre> tag. It will helps you to write pre-formatted text.
9th Sep 2020, 5:29 PM
Nihal Priyadarshi