HTML Paragraphs – HTML Tutorials – Web Development

In this tutorial, we are gonna talk about HTML Paragraphs tag. If you want to read the previous tutorial on HTML Headings, Click Here. So without any further due, let’s get started.

The <p> tag defines a paragraph. A paragraph is nothing but just a set of lines. I think you know that, but just to be on the safe side, I mentioned it.

Example, given below:

<p>A paragraph can contain a single line</p>

<p>A paragraph can also contain multiple lines. Like this one. This paragraph has more than one lines.</p>

Display

One cannot be 100% sure how the HTML will be displayed on the screen.

Large screens, small screens, resized window will have different kind of results for each of them.

If you are thinking of adding extra lines or space just for the fact to make them ideal, don’t. The web- browser will automatically remove the extra spaces or lines that are added.

For example:

<p>This is a paragraph,

with lot of lines, just to

show you that it doesn’t work like this in HTML</p>

<p>This is another paragraph ,

with lots of spaces and this also doesn’t work

in HTML</p>

<hr> & <br> Tag

First let’s discuss about the <hr> tag.

The <hr> tag is used to denote a horizontal line in HTML.

Example given below:

<h1> A Heading Tag </h1>

<p> A paragraph. After this will come a horizontal line. </p>

<hr>

<h2> Another Heading Tag </h2>

<p> Some more content.</p>

HTML hr tag

Now lets talk about the <br> tag.

The <br> tag is used to denote a break in HTML.

Example given below:

<p> This is just some content <br> with a line break</p>.

HTML br tag

Both, <hr> & <br> tag is an empty tag i.e., they don’t have an ending tag.

To read about Empty Tags in detail, Click Here.

You Want, What You Want!

What can you possibly do if you want extra white spaces and extra lines like the examples above in your HTML?

It is very much simple. All you need to do is use <pre> Tag instead of <p> Tag.

The <pre> tag stands for preformatted text. It preservers all your extra white spaces and lines as it is.

Example given below:

<pre>

This is line 1.

Another line with some spaces.

This is another

line with some spaces.

</pre>

HTML pre tag

This was it in this tutorial. See yaa in next one.😉

1 thought on “HTML Paragraphs – HTML Tutorials – Web Development”

Leave a Comment

Your email address will not be published. Required fields are marked *