Recall & Review
beginner
What is the purpose of the <pre> tag in HTML?
The <pre> tag is used to display text exactly as it is written, preserving spaces, line breaks, and indentation.
Click to reveal answer
beginner
How does the <pre> tag affect white space in the browser?
The <pre> tag preserves all white space including spaces, tabs, and new lines, unlike normal HTML where white space is collapsed.
Click to reveal answer
beginner
Which HTML tag would you use to show code snippets with exact formatting?
Use the <pre> tag to show code snippets with exact formatting, preserving indentation and line breaks.
Click to reveal answer
intermediate
Can you nest other HTML tags inside <pre>? What happens?
Yes, you can nest tags like <code> inside <pre>. The <pre> preserves formatting, and nested tags can add semantic meaning or styling.
Click to reveal answer
beginner
What is the difference between <pre> and normal paragraph (<p>) text?
Normal paragraphs collapse white space and ignore extra spaces or line breaks. <pre> shows text exactly as typed, including spaces and line breaks.
Click to reveal answer
What does the <pre> tag do in HTML?
✗ Incorrect
The <pre> tag preserves all white space and line breaks exactly as written.
Which tag is best for showing code with indentation in HTML?
✗ Incorrect
The <pre> tag preserves indentation and line breaks, ideal for code display.
What happens to multiple spaces inside a normal paragraph (<p>) tag?
✗ Incorrect
HTML collapses multiple spaces into one space inside normal text elements like <p>.
Can you use other tags inside <pre> to style text?
✗ Incorrect
You can nest other tags inside <pre> to add meaning or style while preserving formatting.
Which of these is NOT true about <pre>?
✗ Incorrect
By default, <pre> does not wrap long lines; text scrolls horizontally instead.
Explain how the <pre> tag affects text formatting in a web page.
Think about how text looks when you want to keep indentation and spacing.
You got /4 concepts.
Describe a real-life situation where using <pre> would be helpful on a website.
Consider when exact spacing and line breaks matter.
You got /4 concepts.