What is HTML Tag – What is HTML Tag and Types of HTML Tags? Friends, to design any webpage, we need HTML (HyperText Markup Language) and in HTML we design our webpage by tag, but do you know what HTML tag is?
What is HTML Tag
Whenever we design any webpage, we use some command to design that webpage, it is called HTML tag. Tag is always written inside angle bracket like <tag>..</tag>.
HTML tag is a set of many characters that act as commands in the HTML language, through which we design our webpage. HTML tag is a hidden keyword in the webpage which tells our web browser how to format this webpage.
Rules for writing Tags:
Just as there is a rule to write any function in a programming language, in the same way there are some rules for writing tags. So let’s see what the rules are:
- Tags should be written inside angle bracket (<>) . such as <html>. If you do not write the tags inside the angle bracket, then the web browser will understand it as simple text and will display it as text.
- There should be no space between any tags.
- Incorrect tag type: <ht ml>..</ ht ml>
- How to write correct tags: <html>..</html>
- Tags are not case sensitive, you can also write it in capital or small letter. But generally it is better to be written in small letter only.
- Whenever you do opening tags, it is important to write its closing tags as well. If you do not write, then the formatting of that tag will be applied till where you will get the closing tags worth it. For example: In this program, I have not given the closing tag of <h1> tag, then it will be applied to all the content. h1 tag is used for heading.
<!DOCTYPE html> <html> <head> <title>Example of Opening and Closing tags</title> </head> <body> <h1> How are you? <p> I am Fine</p> <p>What are you doing?</p> </body> </html>
There are two types of HTML tags:
- Container / Pair tag
- Empty / Singular tag
Container tag is also known as Pair or on-off tag. The tags in which both opening and closing tags are available are called Container / Pair / On-Off tags. In other words, the tags which are used in the pair ie, it is called Container / Pair / On-Off tag. Closing tags and opening tag both are same but closing tags have forward slash (/) before tag name.
This tag defines a section, meaning that the container tag tells how far the formatting of this tag is to be applied. There are many examples of container tags, so let us see which are the container tags. Friends, I am not showing the list of all the tags here, I am showing the list of what is important.
- <html> … </html>
- <head> .. </head>
- <body> .. </body>
- <title> .. </title>
- <h1> .. </h1>
- <h2> .. </h2>
- <h3> .. </h3>
- <h4> .. </h4>
- <h5> .. </h5>
- <h6> .. </h6>
- <p> .. </p>
- <div> .. </div>
- <table> .. </table>
- <tr> .. </tr>
- <td> .. </td>
- <th> .. </th>
- <audio> .. </audio>
- <video> .. </video>
- <span> .. </span>
- <em> .. </em>
- <strong> .. </strong>
- <aside> .. </aside>
- <button> .. </button>
- <form> .. </form>
- <iframe> .. </iframe>
- <kbd> .. </kbd>
- <ul> .. </ul>
- <li> .. </li>
- <ol> ..</ol>
- <select> .. </select>
- <textarea> .. </textarea>
In the details about all these tags, we will read in the coming post.
2: Empty / Singular Tag
Empty tag is also called Singular or Stand Alone tag. Those tags which do not have closing tags are called empty tags. The tag in which the content is not available is called empty tag.
Sometimes container tags also fall under the category of empty tags, if there is no content available in them. Like <p> </p> it will be an empty tag because no content is available inside it and if the content is made available inside it then it will come in the category of container tag.
Empty tag के list:
In HTML5 version you do not need to give forward slash at the end of empty tag, you can write empty ie singular tag without forward slash like <br>, <img>
|<!DOCTYPE>||The full form of DOCTYPE is Document Type.
|<a>||This is a hyperlink tag, it is used for page linking.|
|<abbr>||This tag is used to show the full form of any text.|
|<address>||This tag is used to write the address.|
|<area>||This tag is used to define the area in any image. this tag always|
|<article>||This tag is used to write the definition of any topic.|
|<audio>||This tag is used to add audio such as sound, music to the webpage.|
|<b>||The tag is used to make any text bold.|
|<base>||This tag is used to specify the base of all relative URLs in the document.|
|<bdo>||This tag is used to change the current text direction.|
|<blockquote>||This tag is used to give double quote.|
|<body>||This tag specifies the body of the HTML document.|
|<br>||This tag is used to break the line.|
|<button>||The <button> tag is used to make a clickable button.|
|<canvas>||This tag is used to draw graphics.|
|<caption>||This tag is used to give the heading of the table i.e. caption.|
|<code>||This tag is used to define the computer code.|
|<col>||This tag is used to apply style to a specific column.|
|<colgroup>||This tag is used for formatting one or more columns in a table.|
Conclusion and Final Words
No webpage can be designed without HTML tags whether it is made in PHP or ASP or JSP. The most basic for designing any webpage is HTML tag. There are two types of HTML tags: Container and Empty tag.
Friends, I have given information about HTML tag in this post. In this post, we have listed only a few tags. I hope you have liked this post very much, do share this post with your friends and if you find any kind of mistake in this post, then you inform me immediately so that I can rectify that mistake.