Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Going Further with HTML HTML Entities and Reserved Characters

What is a <pre></pre> tag?

What is a <pre></pre> tag in other words? When do you use it? Thanks

Tadjiev Codes
Tadjiev Codes
9,626 Points

https://www.w3schools.com/tags/tag_pre.asp It basically has it's own format of showing the paragraph. You can see the exercise in W3Schools)

2 Answers

Hi, here is my understanding of a pre tag : The <pre> is used tag to define preformatted text. Text in a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks. Please mark as best answer if helped you!

The pre tag displays the text embedded within the pre tag as it is written. It is rendered using the monospace font. Suppose you want to display piece of text as it is in the browser, then just place it between pre tag. Hope it helped you understand.