Skip to main content

HTML Paragraphs

By SamK
0
0 recommends
Topic(s)

A paragraph in HTML is typically a block of text. Each paragraph always begin on a new line. 

It is defined in HTML by the <p> element. Paragraphs are block elements.

Browsers automatically add some white space (margin) before and after a paragraph for improved layout and readability.

Example:

<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p> 

The display of HTML content can vary depending on factors such as screen size and window resizing.

In HTML paragraphs, if you add extra spaces inside the text, they will be automatically removed from the page during rendering by the web browser.

Also, Line breaks within <p> tags will be displayed as a single line.

For example, the paragraph

<p>This is       a paragraph with    spacing
and line breaks</p>

will be displayed on the page in the same way as the following paragraph

<p>This is a paragraph with spacing and line breaks</p>

while rendering. This issue can be solved either by using <br> tags within the <p> tags or replacing them with the <pre> tag, which will be covered in the next tutorial.

Please check below options for the links to our previous or next tutorial.

Questions & Answers