HTML Paragraphs
HTML Tutorial
HTML Paragraphs
CompletedThe HTML <p> element defines a paragraph:
1<p>This is a paragraph.</p>
2<p>This is another paragraph.</p>
HTML Display
CompletedYou cannot be sure how HTML will be displayed.
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.
The browser will remove any extra spaces and extra lines when the page is displayed:
1<p>
2This paragraph
3contains a lot of lines
4in the source code,
5but the browser
6ignores it.
7</p>
8
9<p>
10This paragraph
11contains a lot of spaces
12in the source code,
13but the browser
14ignores it.
15</p>
Don't Forget the End Tag
CompletedMost browsers will display HTML correctly even if you forget the end tag:
1<p>This is a paragraph.
2<p>This is another paragraph.
HTML Line Breaks
CompletedThe HTML <br> element defines a line break.
Use <br> if you want a line break (a new line) without starting a new paragraph:
1<p>This is<br>a paragraph<br>with line breaks.</p>
The Poem Problem
CompletedThis poem will display as one line:
1<p>
2 My Bonnie lies over the ocean.
3
4 My Bonnie lies over the sea.
5
6 My Bonnie lies over the ocean.
7
8 Oh, bring back my Bonnie to me.
9</p>
The HTML Element
CompletedThe HTML <pre> element defines preformatted text.
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:
1<pre>
2 My Bonnie lies over the ocean.
3
4 My Bonnie lies over the sea.
5
6 My Bonnie lies over the ocean.
7
8 Oh, bring back my Bonnie to me.
9</pre>
