HTML Paragraphs

HTML Paragraph tag is always starting to create new lines and. It is block-level text. It is used to publish the text on web pages. It is defined with <p> tag.

Example

Try Now


<p>This is my first paragraph.</p>
<p>This is my another paragraph.</p>     

Note: The browsers automatically add some white space before and after a paragraph

Closing a paragraph Element

In HTML when we use some <p> tag and forget to close </p> then the browser displays the output. But don’t rely on it. Forgetting the end tag can produce unexpected results or errors.

Try Now


<p>This is a paragraph.
<p>This is another paragraph.

Note: We should always start and close the tag. But some are exceptions. We will learn.

HTML Display

We cannot be sure how HTML will be displayed. It depends on the screen resolution (Window Resize) and we can see the different results.

The browser will remove extra or white spaces and line automatically when pages are displayed.

Try Now


<p>
This is an example of a paragraph which
contains a lot of lines
in the source code,
but the browser
ignores it.
<p>
 This is the example of paragraph
 a lot of spaces
but the browser
ignores it.
</p>

HTML Empty Tags

The tag which has no closing tag is called empty a tag. It only starts not closes.  Like <br>, <hr>, <img> etc.

Example

Try Now

<h1>This is heading 1</h1>

<hr> 

<p>This is some text. <br> inside this text <br> empty tag i used<p>

HTML Horizontal Rules

The Horizontal <hr> tag is used to define a thematic break in the HTML page. It is often displayed as a horizontal rule.

It is used to separate the content in HTML Pages.

Try Now


<h1>This is heading 1</h1>
<hr>
<p>This is some text.</p>
<hr> 

HTML Line Breaks

The HTML break <br> tag is used to break the new line. It is denied with <code><br></code> tag.

Try Now

<h1>This is heading 1</h1>

<hr>  it is empty element.

<p>This is example of break some text. <br> inside this text  <br> empty tag we have used <p>

reformatted Text Tag

The Html <pre> preformatted text tag is used to represent preformatted text which is t presented exactly as written in the HTML file. The text is typically rendered using a non-proportional ("monospace") font.

Whitespace inside this element is displayed as written

Try Now

<pre>   
Hi Dude,

          I know you have learned

                                                    About

                                                        preformatted Tag.

( Thanks for Reading ...)
</pre>

HTML White Space

In HTML we can create white space by using "&nbsp;"  If you want to create multiple spaces then we can use it multiple times.

Try Now

<p>This paragraph has multiple&nbsp;&nbsp;&nbsp;spaces.</p>

<p>This paragraph has multiple  spaces.</p>

Note: we can use &nbsp; for white spaces.

Tag

Description

<p>

Defines a paragraph

<hr>

Defines a thematic change in the content

<br>

Inserts a single line break

<pre>

Defines pre-formatted text


Prev Next