HTML Paragraphs

A paragraph always starts on a new line, and is usually a text block.

Example: In this example, we use the <p> tag used for paragraph in HTML.

<p>Your Paragraph.</p>

Paragraph <p> tag

The <p> tag in HTML defines a paragraph. These have opening and closing tags. So anything said within <p> and </p> is considered a paragraph. Many browsers read a line as a paragraph even if we do not use the close mark, </p>, but this may suggest unexpected results. So, both are good meetings, and we should use a closing tag.

Example

<!DOCTYPE html>
<html>
<body>

<p>This is a paragraph.</p>
<p>This is a second paragraph.</p>
<p>This is a third paragraph.</p>

</body>
</html>

Output

HTML Paragraphs

 

 

 

You can not be sure how HTML will be displayed.

Large or small screens, and resized windows will create different effects.

With HTML, you can’t change the template by adding extra spaces or lines to your HTML code.

The browser will automatically delete any additional spaces and lines when the page is displayed

HTML Line Breaks

There is a way to inform HTML where the browser needs to change lines using the <br> tag. These tags do not have closing tags. Therefore, one opening marker will change the line.

<h1>This is a Heading</h1>
<p>This is a paragraph</p>
</br>
<h1>This is a Heading 2</h1>
<p>This is a paragraph 2</p>
</br>

Output

HTML PARAGRAPHS BR TAG

Align attribute

<p align="value">

The <p> tag directly supports the alignment attribute and allows us to align our paragraphs to the left, right, or center alignment.

Example

<p align="left">This Is A Left Paragraph</p> 

  <p align="center">This Is A Center Paragraph</p> 

  <p align="right">This Is A Right Paragraph</p> 

Output

Html paragraph align

<pre> tag

We’ve  tag ignores all additional line and space changes within the paragraph, but there is a way to save this by using the <pre> tag. It also contains an opening and closing tag. Displays text within a fixed length and width and saves additional lines and spaces we use.

Example

<pre> 
    Welcome to KrTricks. I will show you to the 
    paragraph uses in html.
</pre> 

  

 <pre> 
    Welcome to KrTricks. 
                I will show you to the 
    paragraph uses in html.
 </pre>

Output

Html Paragraph Pre Tag

 

 

 

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Leave a Comment

Your email address will not be published.