Program to see difference between paragraphs & normal text with line break
Description: Write a program that shows the difference between two paragraphs and a single text with line breaks.
Hint:
- Use two
<p>tags for the paragraphs. - Use the
<br>tag inside one paragraph for the line break.
Paragraphs and line break program
<!DOCTYPE html>
<html lang="en">
<head>
<title>Paragraph vs line break</title>
</head>
<body>
<h3>Two paragraphs</h3>
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
<h3>One paragraph with a line break</h3>
<p>This is the first line.<br>This is the second line.</p>
</body>
</html>
Output in the browser:
Output in the browser
Two paragraphs
This is the first paragraph.
This is the second paragraph.
One paragraph with a line break
This is the first line.
This is the second line.
How it works
- Each
<p>adds a space above and below, so the paragraphs look separate. <br>only moves the text to the next line. The lines stay close, as they are still one paragraph.- Use paragraphs for separate ideas, and
<br>for things like an address or a poem.
Read HTML Paragraphs.
Learn more about the similar topics:
| Tutorials |
|---|
| HTML Headings |
| HTML Paragraphs |
| HTML Styles |
| HTML Formatting |
| HTML Comments |
| HTML Symbols |