HTML Paragraph

Categories - HTML Tags - HTML   Maniruzzaman Akash   1 month ago   64   3 minutes   0

HTML Paragraph

In HTML, paragraphs are created using the paragraph tag, which is represented by the <p> element. The paragraph tag is used to structure blocks of text on a webpage, and each paragraph of text is separated by a blank line.

A paragraph ever begin on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

Example

<p>This is a paragraph of text 1.</p>
<p>This is a paragraph of text 2.</p>

Live preview

This is a paragraph of text 1.

This is a paragraph of text 2.


In the example above, three separate paragraphs of text are created using the paragraph tag. Each paragraph is enclosed within its own ``

`` element and separated from the other paragraphs by a blank line.

By default, each paragraph of text is displayed with a blank line above and below it, indicating that it is a separate block of text. You can modify the spacing between paragraphs using CSS, or apply additional styling to the text within the paragraph using other HTML tags and attributes.

Using the paragraph tag is a simple and effective way to structure the content of a webpage into logical blocks of text, making it easier for readers to understand and follow the flow of information on the page.

what is Space inside HTML Paragraph

In HTML, a space inside a paragraph can refer to any whitespace character such as a space, tab, or line break that appears between two words or phrases within a paragraph. These whitespace characters are often used to improve the readability and formatting of the text on a web page.

When HTML code is rendered in a web browser, any consecutive whitespace characters within a paragraph are collapsed into a single space. This means that if you include multiple spaces or tabs between two words in your HTML code, the browser will only display a single space between those words.

To create a larger amount of whitespace within a paragraph, you can use the HTML “non-breaking space” character, which is represented by the code  . This character will create a visible space between two words or phrases that cannot be collapsed by the browser.

Example

<p>This is the main content of my web page.</p>
<p>This is a subheading                   for a section 
of my web page.</p>
<p>This is
a sub-subheading                      for           a subsection of my web page.</p>

Output

paragraph-tag

How to Use <br> and <hr> tag with paragraph?

The <br> and <hr> tags can be used with paragraphs in HTML to add line breaks and horizontal rules, respectively.

To use the <br> tag with a paragraph, you simply need to insert it where you want the line break to occur. For example, if you want to add a line break between two sentences in a paragraph, you can do so by placing the <br> tag between them. Here’s an example:

<p>This is the first sentence.<br>This is the second sentence.</p>

This will display the two sentences on separate lines:

This is the first sentence.
This is the second sentence.

To use the


tag with a paragraph, you can place it after the paragraph to add a horizontal rule below it. Here’s an example:

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

This will display the paragraph followed by a horizontal rule:

This is a paragraph.


You can also use CSS to style the <hr> tag with different colors, heights, and styles.

Previous
HTML Headings
Next
HTML Formatting