Table of contents
What are Tags in HTML?
HTML has predefined tags, different tags have different purposes and behavior.
We write the content of our website in between these tags.
We make a better layout with the help of tags.
Syntax of tag.
The tag name has written in between angle brackets ( < > ). For example, "p" tag will be written like this:- <p> </p>. As we can see tag has two parts:-
opening part <p>.
closing part </p>.
As I told you each tag has specific work, for example, if we want to write a heading in our web page then we need to make sure our heading should be bold and larger in size.
So for this we have heading tags, <h1> </h1>. we will write our heading in between this tag and the browser will understand that whatever is written in this heading tag, should be bold and larger because of this heading tag, then the browser will render our heading in bold and large size.
We have 6 types of heading tags:
<h1> Heading 1</h1>
<h2> Heading 2</h2>
<h3> Heading 3</h3>
<h4> Heading 4</h4>
<h5> Heading 5</h5>
<h6> Heading 6</h6>
As we are going from h1 to h6 then our heading size is decreasing.
Just like heading tags, we have so many tags in HTML with different functionalities, we will discuss them in the next blog.
Note:
Tags are case sensitive which means we can write in uppercase also and it will perform the exact work.
<H1> Heading 1 </H1>
<H2> Heading 2 </H2>
<H3> Heading 3 </H3>
<H4> Heading 4 </H4>
<H5> Heading 5 </H5>
<H6> Heading 6 </H6>
we have two types of tags.
Tags which has opening and closing part. (e.g, <p> </p>)
Self-closing tag that does not require a separate closing tag. (e.g, <img>, <br> etc).
Both types of tags have their own work.
What are Elements?
An element is the combination of opening tag, closing tag and content.
Now you know the difference.
Thank you so much for reading it completely, If you liked it do like and comment and follow for more content. Comment for any feedback.