A+ A-

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 another paragraph</p>
Note: The browser will automatically add blank lines before and after the paragraph. (</ P> is a block-level element)

Do not forget to end the label

Even if you forget to use the end tag, most browsers will correctly display the HTML:

Examples

<p>This is a paragraph
<p>This is another paragraph
The above example is no problem in most browsers, but do not rely on this approach. Forgetting to use the end tag will produce unexpected results and errors.
Note: In future versions of HTML, the end tag is not allowed to be omitted.

HTML fold

If you want to wrap (newline) without generating a new paragraph, use the <br /> tag:

Examples

<p>This is<br>a para<br>graph with line breaks</p>
The element is an empty HTML element. Since closing the label does not make any sense, it does not end the tag.

HTML output - use reminder

We can not determine the exact effect HTML has shown. The size of the screen, as well as the adjustment of the window may lead to different results.
For HTML, you can not change the output by adding extra spaces or line feeds to the HTML code.
When the page is displayed, the browser removes the extra spaces and blank lines from the source code . All consecutive spaces or blank lines are counted as a space. It should be noted that all consecutive blank lines (newlines) in the HTML code are also displayed as a space.
(This example demonstrates some HTML formatting issues)

HTML tag reference manual

The self-enhanced school's reference manual provides more information about HTML elements and their attributes.
labeldescription
<p>Define a paragraph
<br>Insert a single line (line feed)

[right-side]

Paragraph HTML can divide a document into paragraphs. The HTML paragraph paragraph is defined by the < p > tag. Example: < p > This is another paragraph < / p > Try it »Note: The browser will automatically add an empty post before and after the paragraph.