In this article, we will look into the details about the end tag in HTML documents.
The elements within an HTML document have a start tag & end tag.
Start tag is the place from where the element begins & end tag is from where the scope of the element ends.
Which character is used to indicate an end tag?
Forwards slash (/) character is used to indicate an end tag.
Below are the code examples of the closing tag for various elements in HTML.
<div>This is div tag</div> <a>This is anchor tag</a>
In the above HTML Syntax, div & anchor elements are having an end tag.
As we can see, both the tags have a start tag & end tag whereas the content is placed in between the starting & closing tag.
Below is the structure of end tag :-
- End tag starts with less than symbol (<).
- Then we add Forward slash (/). This indicates the closing of the tag.
- Then we add the Element name.
- Lastly we add greater than symbol (>).
What is an end tag?
In HTML documents, we have elements that build the structure of the HTML document.
We have a start tag & end tag for all the elements except a few.
The content is written in between the start & end tag.
When we begin a HTML tag, it is necessary to close it otherwise the page will be mis-aligned or display inaccurately.
Do all HTML have an end tag?
There are some HTML elements that do not possess any content so they only have a single tag & no closing tag.
These are also called Empty elements.
Below are some of the examples of Empty elements.
<br> <img> <textarea> <input>
In this article, we provided an explanation & explored details about the end tag in HTML.
We also demonstrated the syntax for the end tag for clear understanding.
For any queries or suggestions about this article, you can put a comment below.