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 trialJuan Avina
12,899 PointsRegarding <pre> tag and default indentation.
Just wanted to clarify something: the text indentation in the <pre> tag is actually cause by the structured indenting in the HTML file. It will actually start at the left edge if we remove the indent from the HTML code. Example: <pre> Here is some text. It is... preformatted! </pre>
The indents removed from the "It is..." line will place that particular text at the left edge of the browser page. It's reminiscent of WYSIWYG...
1 Answer
Donald McLamb
2,867 PointsHi Juan,
the <pre> tag is short for pre-formatted. If you have indentation in the text of your html then that is how it will display, if not then it will not display. If you want to utilize pre-formatted text you would want to use the <pre> tag over a <p> tag. Yes, non-formated or structurally modified elements will display from the top-left of the page
Ed Bundy
5,408 PointsEd Bundy
5,408 PointsThank you for pointing this out. The wording used in the video is "You'll notice that by default, the preformatted text is slightly indented". This makes it sound like some automatic indention is inherent in the element so this is what I jotted down in my notes-- until I read your comment. Thanks!