In this article, we will discuss What is an HTML end tag and how important is it. And also discuss which character is used to indicate an end tag.
What is the end tag?
In HTML we create everything using a tag, between the start tag and end tag we write content. If we start a tag we should end it with an end tag For example if we start a <p>tag we should end it with an end tag </p>. For some HTML tags, we don’t need to give end tag forex: <img>, <input>, <br> because they are unpaired tags. We need to give end tags only to paired tags <span>, <div>, <li>, etc. The start tag doesn’t contain a forward slash but the end tag must have a forward slash (/).
The forward slash special character is used to Indicate an end tag.
Syntax of an end tag
- First, you need to put a less-than sign or character (<).
- The second character of an end tag must be a forward slash symbol (/). In HTML, the SOLIDUS or forward slash (/) character is used to indicate an end tag.
- Then you need to put a tag name or element name for ex: div, span, a, etc.,
- Finally, the greater-than sign or character (>) should be given.
<p> End-tag in HTML </p>
In the above code, some text is given between starting <p> and end tag </p>. If you give the start tag in HTML you must give the end tag.
What happens if you don’t give an end tag?
<h1> Welcome <p> Hello Everyone
This example shows what happens if you don’t give an end tag. In the above HTML code, only the start tag is given for the h1 and p tags, and no end tag is given. Since no end tag is given, the text “hello everyone” in the <p> tag in the output is also displayed as a heading h1 tag. So, you should give an end tag in all HTML paired tags.
Through this article, I hope you know what is an HTML end tag and how important it is.