Last Updated on September 25, 2023 by Mayank Dham
HTML is popularly used by web developers to create websites and web applications many reasons make the developers use HTML one of the main reasons is the HTML tags there are many HTML tags available that make the structure of the website easy to use. We will learn all about these tags while moving further in this blog.
What are HTML Tags?
HTML tags can be understood as some keywords and elements that will define the structure and content of the web page that how will all the content displayed on the webpage. These are the main reason with the help of which the browser can distinguish between simple or normal content and HTML content.
They are used to create and format text, images videos, and other media available on the web.
The HTML tags consist of mainly three components.
- The opening angular bracket or tag(<).
- The content.
- The closing angular bracket or tag(>)
Like in the < h1 > tag. We have the opening bracket(<) the content(h1) and the closing bracket(>).
Every tag in HTML performs a unique function and they must be enclosed in between (< >) brackets.
Importance of HTML Tags
The HTML tags are very much important to use and some of the reasons for their importance are given below:
- The HTML tags provide a standard structure for creating webpages that can be easily rendered by the webpages.
- With the use of basic HTML tags, the web page can change from a jumbled mess of text to a well-structured page.
- We can add various interactive features like buttons, forms, multimedia content, etc.
- The proper use of HTML tags can make web pages easy to access and user-friendly.
Types of HTML Tags
We can distinguish the HTML tags on various parameters but here we will discuss based on the closing tag. There are mainly two types of HTML tags and they are mentioned below:
- Closed Tag
- Unclosed Tag
Closed Tag
As the name suggests these are the types of HTML tags that have opening and closing tags both. The content between the opening and closing tags will only be affected by these types of tags. The closed HTML tags list is:
< p>< /p>
< h1>< /h1>
< strong>< /strong>
< b>
< head>< /head>
< body>< /body>, etc.
Unclosed Tags
These are the type of HTML tags that does not need a closing tag as they can work only with the opening tag and they are also known as a self-closing tag.
The unclosed HTML tags list is:
< br>
< hr>
< img>,etc.
Explanation of Some of the Tags
In this section, we will discuss the explanations of some of the HTML tags as the rest will be discussed in the further blog where they are used.
- Title tag: As the name suggests this tag will set the title of the web page.
- p tag: This is one of the most used in HTML as the content between its opening and closing tag will be displayed in the form of a paragraph.
- h tag: The h tags are the headings tag we can have these tags from h1 to h6 and they will all change the size and boldness of the heading accordingly.
- a tag: This tag is used for hyperlinks as with the help of this we can link one page to another.
- hr tag: This tag is used to add a horizontal line in the display after and before the content is placed.
- br tag: It is used to break the content and start the remaining content from the next line.
- head tag: This tag will contain all the information about the webpage from its styling in CSS and javascript to the title and metatags.
We will learn about the rest of the HTML tags in the continued blogs when they are used.
Example of Tags
Now we will see an example and tell you how to use some of the tags mentioned above with their output.
Code
< h1>HTML Tags< /h1>
< p>Hello in this article you are learning about various tags in HTML. < br> You will see a lots of HTML tags with example and we will aslo see the types of HTML tags< /p>
< hr>
< a href="https://www.prepbytes.com/">You can visit our website
Output
Explanation
In the above code we have seen the use of the p tag, and br tag as br tag breaks the paragraph, the hr tag will add the new line the tag will redirect to the mentioned link. The h1 tag is for the heading.
Conclusion
In the above article we have seen learned about HTML tags, we have seen the three components of HTML tags followed by the types of HTML tags. We have seen the explanation of some of the tags and at last, we have used the tags in the example in which we have understood their use more effectively.