aragraphs

What is an HTML Paragraph?

An HTML paragraph is a block of text wrapped inside the <p> tag. Paragraphs are used to structure content on a webpage, breaking up text into readable sections.

Here is an example of a basic paragraph:

<p>This is a simple paragraph of text.</p>

Basic Paragraph Structure

To create a paragraph in HTML, simply wrap your text inside the <p> element. Here's an example:

<p>This is a paragraph of text in HTML.</p>

The browser will automatically add some space (called margin) before and after each paragraph to separate it from other content on the page.

Line Breaks and Spacing in Paragraphs

If you want to add a new line within a paragraph, without starting a new paragraph, you can use the <br> (line break) tag. Here's an example:

<p>This is a paragraph.<br>This line is broken but still part of the same paragraph.</p>

The <br> tag allows you to control the flow of text within a paragraph, forcing a line break where needed.

By default, browsers will ignore extra spaces and line breaks within the <p> tag, so even if you add multiple spaces or line breaks in the code, they won’t appear on the webpage unless you use the <br> tag.

Best Practices for Using Paragraphs