HTML paragraph or HTML p tag is used to define a paragraph in a webpage. Let's take a simple example to see how it work. It is a notable point that a browser itself add an empty line before and after a paragraph.
<p>This is first paragraph.</p> <p>This is second paragraph.</p> <p>This is third paragraph.</p>Try it with the Editor
If you put a lot of spaces inside the HTML p tag, browser removes extra spaces and extra line while displaying the page. The browser counts number of spaces and lines as a single one.
<p> This paragraph in the source code, but the browser ignores it. </p> <p> This paragraph in the source code but the browser ignores it. </p>Try it with the Editor
In example you can see, all the extra lines and unnecessary spaces are removed by the browser.
HTML <br> tag or element is used to break line in a paragraph.
It is an empty tag, means it does not need a end tag.
The line-break tag can also be used to separate lines like this:
<p>This paragraph <br> in the source code <br> but the browser ignores it.</p>Try it with the Editor
You can use HTML br tag two ways: <br> and <br/>. It is recommended to use closed br tag <br/> because it is supported in HTML and XHTML both.
Sometimes you want your text to follow the exact format of how it is written in the HTML document. In those cases, you can use the preformatted tag <pre>.
The HTML <pre> tag is used to specify pre formatted texts. Texts within <pre>...</pre> tag is displayed in a fixed-width font. Usually it is displayed in Courier font. It maintains both space and line break.
<pre> This paragraph in the source code but the browser ignores it. </pre>Try it with the Editor