HTML Paragraph
HTML paragraph or HTML <p> tag is used to publish the text on the web pages. It is an important point that a browser itself adds an empty line before and after a paragraph. An HTML <p> tag indicates starting of new paragraph.
Note: you can use the various <p> tags in one HTML document then the browser automatically adds a single blank line between the two paragraphs.
Example:
<!DOCTYPE html> <html> <body> <p>This is first paragraph.</p> <p>This is second paragraph.</p> <p>This is third paragraph.</p> </body> </html>
OUTPUT:
Space inside HTML Paragraph:
If you put a lot of spaces inside the HTML p tag, the browser will automatically remove any extra spaces and extra lines while displaying the page. The browser counts the number of spaces and lines as a single one.
Example:
<!DOCTYPE html> <html> <body> <p> you can going to provide extra information for this tutorial </p> <p> Look, you put here a lot of spaces and you know, Browser will remove it. </p> <p> You can't main the display of HTML</p> <p>because re-sized different result. </p> </body> </html>
OUTPUT:
In the above example all the extra lines and unnecessary spaces are removed by the browser.
Use <br> :
An HTML <br> tag is used if you want a line break and it can be used with paragraph elements.
Example:
<!DOCTYPE html> <html> <body> <p>This is<br>a paragraph text use <br>with line breaks.</p> </body> </html>
OUTPUT:
Use <hr> :
An HTML <hr> tag is defined to apply a horizontal line between two statements or two paragraphs.
Example:
<!DOCTYPE html> <html> <body> <h1>This is first heading 1</h1> <p>This is some text.</p> <hr> <h2>This is second heading 2</h2> <p>This is some other text.</p> <hr> <p>This is some other text.</p> <hr> </body> </html>
OUTPUT: