HTML Paragraph
HTML can divide a document into paragraphs.
HTML Paragraph
Paragraphs are defined by the <p> tag.
Examples
<p>This is a paragraph</p> <p>This is a paragraph</p>
Note: The browser will automatically add blank lines before and after paragraphs. (</p> is a block-level element)
Don’t forget the closing tag
Even if you forget to use the closing tag, most browsers will display the HTML correctly:
Examples
<p> This is a paragraph <p> This is another paragraph
The above example will work in most browsers, but don’t rely on it. Forgetting to use a closing tag can produce unexpected results and errors.
Note: In future versions of HTML, omitting the end tag will not be allowed.
HTML line breaks
If you want a line break (new line) without creating a new paragraph, use the <br> tag:
Examples
<p> This <br> paragraph <br> demonstrates the effect of line breaks </p>
The <br /> element is an empty HTML element. It has no closing tag, since a closing tag has no meaning.
HTML Output – Usage Reminder
We cannot determine the exact effect of the HTML being displayed. The size of the screen, and resizing of the window may lead to different results.
With HTML, you cannot add extra spaces or line breaks in the HTML code to change the output.
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 one space. It is important to note that all consecutive blank lines (line breaks) in the HTML code are also displayed as one space.
(This example demonstrates some HTML formatting issues)
This site example
HTML Paragraphs
How to display HTML paragraphs in a browser.
Use line breaks
in HTML documents.
Typesetting a Tang Dynasty poem in HTML code
When displaying HTML, the browser will omit extra whitespace characters (spaces or carriage returns, etc.) in the source code.
More Examples
More Paragraphs
Default behavior for paragraphs.
HTML Tag Reference
The Tag Reference of the Novice Tutorial provides more information about HTML elements and their attributes.
IT Resource Hub » HTML Paragraph