English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML can divide a document into several paragraphs. The content of the article is usually also composed of multiple paragraphs.
Paragraphs are defined by the <p> tag.
<p>This is the first paragraph (oldtoolbag.com) </p><p>This is the second paragraph</p>Test to see ‹/›
Note:</p> is a block-level element, and the browser will automatically add blank lines before and after the paragraph.
Of course, even if you forget to use the closing tag, most browsers will still display the HTML:
<p>This is the first paragraph <p>This is the second paragraphTest to see ‹/›
The above example will work in most browsers, but do not use this method. Forgetting to use the closing tag can produce unpredictable errors, causing the page content to be misaligned and affecting the page layout, etc.
Note: Do not forget to close the tag
If you just want to break lines of plain text content and not create a new paragraph, please use <br>or<br /> For line breaks, use the tag:
<p>This is a<br>normal line break within a paragraph<br>This demonstrates the effect of line breaks</p>Test to see ‹/›
<br /The > element is an empty HTML element. Since the closing tag has no meaning, it does not have an end tag
We cannot determine the exact effect of the displayed HTML. The size of the screen and adjustments to the window can lead to different results.
For HTML, you cannot change the output effect by adding extra spaces or line breaks in the HTML code.
When displaying the page, the browser will remove extra spaces and blank lines from the source code. All consecutive spaces or blank lines are counted as one space. It should be noted that all consecutive blank lines (line breaks) in the HTML code are also displayed as one space.
(This example demonstrates some possible formatting issues that may be encountered with HTML).
HTML Paragraphs
How to display HTML paragraphs in a browser.
HTML Line Break
Using line breaks in HTML documents
Formatting a poem in HTML
When displaying HTML code, browsers will automatically omit extra whitespace characters, spaces, and line breaks from the source code (such as...).
More paragraphs
The default behavior of paragraphs
The tag reference manual of the basic tutorial provides more information about HTML elements and their attributes.
Tags | Description |
---|---|
<p> | Define a paragraph |
<br> | Insert a single line break (newline) |