Featured Post

How to Create HTML Headings and Paragraphs

 





Introduction


This HTML guide is part of the full-stack web development course, starting from basic HTML. In this post, we will learn what are HTML tags and how to write the heading tag in HTML. These tags are usually some words enclosed by  angle brackets, that is written as < and >.

The basic HTML tags that form part of the structure of a document in html  are heading tags, paragraph tags  and listing tags. There are several more tags, but, we will go through all of them  in different posts, so that , you are not burdened to learn all of the basics in just one sitting!


What are HTML tags?


HTML tags are basic html elements that assists you to structure your HTML document and Heading tags are used to write different headings for a html document as explained in detail in this post. 



Headings


Every document has different types of headings and html has 6 types of heading tags , namely, h1 ,h2 ,h3, h4, h5 and h6.

Let’s understand the differences between the different heading tags mentioned above. Based on a decreasing chronological order, h1 is the largest heading, h2 is smaller than h1, h3 is smaller than h2, h4 is smaller than h3 , h5 is smaller than h4, h3 is smaller than h4 and h2 is smaller than h1. 

The following code will show you the difference between the different heading tags. Please note that there will be an opening and closing tag for all the tags including the heading tags. The opening tag is written as <> and the closing tag is written as </>. In between each of the opening and closing tags, we will be writing some text as shown below, but, when you see the output in the console, you will get the output in different sizes due to the differences between the heading tags h1 ,h2, h3, h4, h5 and h6 as explained above.


Code

 

<h1>Hello World!</h1>

<h2>Hello World!</h2>

<h3>Hello World!</h3>

<h4>Hello World!</h4>

<h5>Hello World!</h5>

<h6>Hello World!</h6>



Output

Hello World!

Hello World!

Hello World!

Hello World!

Hello World!
Hello World!



What is a Paragraph tag

Paragraph tags are used to structure your paragraphs in an HTML document so that your document looks spaced out and has a clean structure based on the different layers of  topics or discussions in the document. 

The paragraph tags are indicated by using the open and close <p> and </p. tags respectively.


Why use a Paragraph tag?

In  the above paragraphs, we have learnt how the heading tags define the different headings in our html document and in this section we are going to learn how the paragraph tags are going to define the different paragraphs in our html document. 

The idea of using the paragraph tag is to separate out different chunks of texts into various blocks  of texts in order to come up with several unique paragraphs that identifies individual set of text content within the respective set of paragraphs , so that the user or reader can experience a smooth reading experience while at the document. As we all know, separate topics and sub-topics if structured within separate paragraphs, could result in an efficiently structured and organized reading content. This kind of structuring of the text inside a website page document is only possible by applying the paragraph tags.


How to Create and Use Paragraph tags

Now that we know, as detailed above, the reason for  having paragraphs in our html text document, let us learn , how to create and use the paragraph tags. The paragraph tag is written inside the open p tag as <p> and it also has an ending p tag that is written as </p>


So, the paragraph element is created and defined by writing the starting and ending p tags respectively, that is, starting p tag is written as <p> and the ending p tag as </p> Please note how the p is written in both the cases within the starting and the ending p tags.


After writing the paragraph tags, we can write some content in between the starting and the closing p tags and for the viewer, the p tags are not visible, only the coder is able to see the tags, and the viewer is only able to see the contents within the paragraph tags, Let us consider an example code to understand.


Code


<p> Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren 
Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren
Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem
Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem
Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren
Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren
Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren
Ipsum Loren Ipsum Loren </p>


Console Output

Inside the console screen, the display will read as the following paragraph lines as shown below:


Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren Ipsum Lorem Ipsum Lorem Ipsum Loren Ipsum Loren Ipsum Loren


Explanation

As we see in the code block above, the paragraph tags with the opening <p> tag and the ending </p> tag helped in write several paragraph for the html document and form part of the content. The opening tag <p> has the angle brackets as shown here and the ending tag shown as </p> with the forward slash as shown here inside the angular brackets. 

In both the tags we write the letter p inside the angular brackets to indicate that it is a paragraph tag. If we forget to write either the opening or starting paragraph tag that is, <p> or the ending or closing paragraph tag, that is, </p>, then the code output will throw up an error in the console .



Conclusion

As you can see in the output, the different heading tags in the decreasing order from h1 to h6, gives the above output in terms of the different sizes of the heading text as shown above in the console. H1 heading tag gives us the biggest heading text size  for our html document text. So, we now learnt how to define different headings in an html document by using the headings tags.

We also learnt about using paragraph tags in HTML and how to use it appropriately in your html document to enable the viewer to see a document with beautiful layout of content arranged in neat and structured paragraphs.





Comments

Popular Posts

Build A Random Quote Machine in React

A Simple Guide to Promises in JavaScript ES6

Welcome to my first Blog Post

Top Free Online Websites to Learn Coding

Build A Calculator in React

Beginner's Guide On For Loop in Python

How to remember code in your learning phase