HTML Paragraphs

HTML Paragraphs

A paragraph always starts on a new line, and is usually a block of text. The HTML <p> element defines a paragraph. A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

Example

<p>This is a paragraph.</p>

HTML Display

You cannot be sure how HTML will be displayed. Large or small screens, and resized windows will create different results. With HTML, you cannot change the display by adding extra spaces or extra lines in your HTML code. The browser will automatically remove any extra spaces and lines when the page

<p>
This paragraph
contains          a lot of spaces
in the source       code,
but the    browser
ignores it.
</p>

Output:

This paragraph contains a lot of spaces in the source code, but the browser ignores it.


HTML Line Breaks

The HTML <br> element defines a line break.Use <br> if you want a line break (a new line) without starting a new paragraph.

<p>This is <br> a paragraph <br> with line breaks.</p>

Output:

This is
a paragraph
with line breaks.


The Poem Problem

This poem will display on a single line.

Solution - The HTML <pre> Element

This poem will display on a single line.

<p>
this is paragraph with poem problem.
this is paragraph with poem problem.
this is paragraph with poem problem.
</p>

<pre>
this is paragraph with solution the html <pre> tag.
this is paragraph with solution the html <pre> tag.
this is paragraph with solution the html <pre> tag.
</pre>

Output:

this is paragraph with poem problem. this is paragraph with poem problem. this is paragraph with poem problem.

this is paragraph with solution the html <pre> tag.
this is paragraph with solution the html <pre> tag.
this is paragraph with solution the html <pre> tag.

Leave A Comment :