HTML paragraph
HTML can divide a document into paragraphs.
HTML paragraph
Paragraphs are defined by
tags.
Example
<
p
This is a paragraph
p
<
p
This is another paragraph
p
Try it »
**Note:** Browsers automatically add blank lines before and after paragraphs. (
is a block-level element)Do Not Forget the Closing Tag
Even if you forget to use the closing tag, most browsers will still display the HTML correctly:
Example
<
p
This is a paragraph
<
p
This is another paragraph
Try it »
The example above works fine in most browsers, but do not rely on this practice. Forgetting the closing tag can produce unexpected results and errors.
Note: In future versions of HTML, omitting the closing tag will not be allowed.
HTML Line Breaks
If you want to break a line (a new line) without producing a new paragraph, use the
tags:
Example
<
p
This
<
br
Paragraph
<
brdemonstrates the effect of line breaks
p
Try it »
The element is an empty HTML element. Since a closing tag would have no meaning, it has no closing tag.
HTML Output - Useful Reminders
We cannot determine the exact effect of how HTML will be displayed. The screen size and window resizing can all lead to different results.
With HTML, you cannot change the output by adding extra spaces or line breaks in the HTML code.
When displaying a page, the browser removes extra spaces and blank lines from the source code. All consecutive spaces or blank lines are counted as a single space. Note that all consecutive blank lines (line breaks) in the HTML code are also displayed as a single space.
(This example demonstrates some issues with HTML formatting)
Examples in This Tutorial
HTML paragraph
How to display HTML paragraphs in the browser.
Newline
Using line breaks in an HTML document.
Formatting a Tang poem in HTML code
When displaying HTML, the browser omits extra whitespace characters in the source code (spaces or carriage returns, etc.).
More examples
More paragraphs
The default behavior of paragraphs.
HTML Tag Reference Manual
The Runoob Tutorial tag reference manual provides more information about HTML elements and their attributes.
| tag | Description |
|---|---|
| Defines a paragraph | |
|
|
Inserts a single line break |