HTML Paragraph


HTML can divide a document into paragraphs.


HTML paragraph

Paragraphs are defined by <p> tags.

Example:
               <p>this is a paragraph </p>
                <p>this is another paragraph</p>

Note: Browsers 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:

example:

<p>This is a paragraph 
<p>This is another paragraph

The above example will work fine in most browsers, but don’t rely on this practice. Forgetting to use closing tags can produce unexpected results and errors.

Note: In a future version of HTML, omitting the closing tag is not allowed.


HTML wrapping

If you want a line break (new line) without generating a new paragraph, use the <br> tag:

< p > This <br> paragraph <br> demonstrates the effect of line breaks < / p >

The <br /> element is an empty HTML element. Since a closing tag doesn’t make any sense, it doesn’t have an closing tag.


HTML output – usage reminder

We cannot be sure of the exact effect of the HTML being displayed. The size of the screen, and the resizing of the window can all lead to different results.

For HTML, you cannot alter the output by adding extra spaces or line breaks to the HTML code.

When the page is displayed, the browser removes extra spaces and blank lines from the source code. All consecutive spaces or blank lines are counted as one space. Note that all consecutive blank lines (newlines) in the HTML code are also displayed as a single space.


HTML Tag Reference Manual

The Beginner Tutorial’s Tag Reference Manual provides more information on HTML elements and their attributes.

Labeldescribe
<p>define a paragraph
<br>Insert a single line break (line break)