Notes
Goal: Learn how to properly structure text content using the paragraph tag. Fix jumbled text into readable, separated paragraphs.
Key Concepts
-
Purpose of
<p>:- Adds spacing between blocks of text (browser automatically adds margin above/below).
- Creates visual separation for readability.
- Important for accessibility (screen readers use
<p>to navigate and pause between paragraphs).
-
Problem without
<p>:- Plain text runs together into one long line → No distinction between paragraphs.
-
With
<p>:- Each paragraph is wrapped → Browser adds line breaks and spacing.
-
Structure:
- Opening tag:
<p> - Closing tag:
</p> - Content goes between them (like headings).
- Opening tag:
Syntax & Code Snippets
- Basic:
<p>This is the first paragraph. It can be as long as you want.</p>
<p>This is the second paragraph. Notice the space above and below.</p>Exercise Summary
- Challenge: Wrap three lines of placeholder text (Lorem Ipsum) in
<p>tags.- Before: All text jumbled into one line.
- After: Three separate paragraphs with spacing.
- Solution:
<p>First paragraph text here...</p>
<p>Second paragraph text here...</p>
<p>Third paragraph text here...</p>- Use Live Preview in VS Code to see changes instantly.
Lorem Ipsum (Placeholder Text)
- Why use it?:
- Avoids repetitive “content content” text.
- Looks natural (varying sentence lengths).
- Used in design/print since 1500s (originally from Cicero’s Latin texts).
- Where to get it:
- lipsum.com (standard, supports different languages)
- Fun versions: baconipsum.com, broipsum.com, pirateipsum, veganipsum, etc.
- Search “funny lorem ipsum” for more.
Common Pitfalls / Gotchas
- Forgetting closing tag → Text runs together or breaks layout.
- Using
<br>for line breaks instead of<p>→ Bad practice (not semantic, hurts accessibility).
Connections to Other Topics
- Builds on heading elements → Headings + paragraphs = basic page structure.
- Accessibility → Later: More semantic HTML (e.g.,
<article>,<section>). - Next lessons: More text elements (lists, links, images).
To Review / Add-On Challenge
- Generate your own Lorem Ipsum (try baconipsum.com or lipsum.com).
- Modify the exercise file: Replace text with new placeholder content.
- Share funny ones in Q&A!
Summary: <p> tags create proper text blocks with spacing and accessibility. Use Lorem Ipsum for realistic placeholders. Simple but essential for readable content.
Add a note to yourself:
“Always wrap text in
<p>for real content.”