0
0
HTMLmarkup~5 mins

Preformatted text in HTML - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ACreates a hyperlink
BMakes text bold
CPreserves spaces and line breaks exactly as typed
DCenters the text
Which tag is best for showing code with indentation in HTML?
A&lt;pre&gt;
B&lt;p&gt;
C&lt;span&gt;
D&lt;div&gt;
What happens to multiple spaces inside a normal paragraph (<p>) tag?
AThey are preserved exactly
BThey turn into tabs
CThey become line breaks
DThey are collapsed into a single space
Can you use other tags inside <pre> to style text?
ANo, &lt;pre&gt; cannot contain other tags
BYes, you can nest tags like &lt;code&gt; or &lt;strong&gt;
COnly &lt;img&gt; tags are allowed
DOnly text is allowed, no tags
Which of these is NOT true about <pre>?
AIt automatically wraps long lines
BIt preserves spaces
CIt preserves line breaks
DIt displays text in a fixed-width font by default
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.