Paragraphs
Learn to write paragraphs with <p> and how text flows.
What is a paragraph?
A paragraph presents a single idea or thought in one block. In HTML, a paragraph is written with the <p> tag. Everything between the opening <p> and closing </p> is the paragraph's content.
The browser leaves a blank line between paragraphs automatically. So to separate two paragraphs you just write two <p> tags.
Text flow
Text flow matters in HTML: the browser shows spaces and line breaks in the source code as a single space. So even if you press Enter inside a <p>, the output still flows on one line.
To break a line inside a paragraph you need another tag. We will see <br> in the next lesson.
Splitting a paragraph
A paragraph can hold sentences, conjunctions and even other inline tags. The point is to gather one idea in one block. Splitting very short sentences into separate paragraphs makes the page look chopped up.
The right way to break a long paragraph is to open a new <p> — pressing Enter is not enough. The browser ignores line breaks in the source.
Exercise Write a two-paragraph summary
Add two <p> paragraphs to body. The first should say A garden is a small corner of nature., the second Each season brings a different color.
Show example solution
<body>
<p>A garden is a small corner of nature.</p>
<p>Each season brings a different color.</p>
</body>
Test yourself
-
Which tag is used for a paragraph?
- <paragraph>
- <p>
- <para>
- <text>
Show answer
<p> — Correct. A paragraph is written with <p>.
-
Close the paragraph
<p>Some paragraph text____Show answer
<p>Some paragraph text</p> -
Match each tag to its role
- <p>
- Paragraph
- <h1>
- Largest heading
- <h2>
- Section heading
- <body>
- Content container