If you want to learn HTML. So you should know what is a tag in HTML. what are tags in HTML, without HTML Tags you cannot write anything in HTML. After reading this article, you will get complete information about HTML tags.
What are HTML tags?
The tags are special codes used to define and identify HTML elements within an HTML document. They consist of angle brackets (“<” and “>”) and the name of the HTML element. Tags come in pairs: an opening tag and a closing tag. The opening tag contains the name of the HTML Tag, and the closing tag has the same name but with a forward slash (“/”) before it.
HTML tags define the structure and content of a web page and determine how the content is displayed in a web browser. They are the building blocks of an HTML document and provide the necessary information for the browser to interpret and render the content correctly.
Question:- HTML tags are surrounded by which type of brackets?
Answer:- They are surrounded by3 angle brackets like <HTMLtag>
the syntax of HTML tags:-
<TagName>Content</TagName> |
<elementName> is the opening tag of an HTML element, where “elementName” is the name of the HTML element, such as <p> for paragraphs or <img> for images. Normally all HTML tags also have a closing tag.
example:-
<p>This is a paragraph.</p> |
Tags Example in HTML
HTML Tags | Name |
---|---|
<!doctype> | document type Tag |
<body> | body Tag of a webpage |
<P> | paragraph tag |
<H1> to <H6> | Heading Tag |
<head> | head Tag |
<i> | Italic Tag |
<u> | Underline Tag |
<big> | Big Tag |
<small> | Small Tag |
<hr> | Horizontal Tag |
Types of HTML Tags
there are two types of tags in HTML
- Container Tag
- Empty Tag
Container tag in HTML
a container tag is a type of HTML tag that comes in pairs: an opening tag and a corresponding closing tag. The content or other nested elements are placed between the opening and closing tags.
Container tags are used to group and enclose content or other elements together, creating a hierarchical structure within the HTML document. They define the relationships between elements and help establish the layout and organization of the web page.
<TagName>_____ </TagName>
The above tags are examples of Container tags, in which ( ____ ) text or any HTML element can be written in the space. As:-
- <html>……..</html>
- <head>…….</head>
- <title>…….</title>
- <body>…….</body>
- <small>……</smll>
- <div>……..</div>
<div> |
Empty Tag in HTML
An empty tag in HTML is a self-closing tag that doesn’t require a separate closing tag. These tags represent elements that do not contain any content, text, or other nested elements. They are used to insert specific elements into the document without any additional content.
Empty tags are written with a forward slash (“/”) immediately before the closing angle bracket (“>”) of the opening tag. This self-closing format indicates to the browser that the element is empty and doesn’t require a closing tag.
Example of empty tag in HTML
- <br/> Tag
- <hr/> Tag
- <img/> tag
- <input/> tag
<p>This is the first line.<br/>This is the second line.</p> |
Output
This is the first line. This is the second line. |
<p>This is some text.</p> <hr> <p>This is more text.</p> |
Output
This is some text. This is more text. |
HTML tags list
Here is an alphabetical list of HTML tags along with brief descriptions:
Tag name | Description |
---|---|
<!– …. –> | This tag is used to define a comment in an HTML document. |
<!DOCTYPE> | DOCTYPE tag is used to specify the document type of the HTMLL |
A | |
<a> | a tag is termed An anchor tag, used to create a hyperlink. |
<abbr> | Use <abbr> to define an acronym for a word. |
<acronym> | Not supported in HTML5<acronym> the tag was used in HTML 4 to define an acronym. |
<address> | It defines the author’s/owner’s contact information for a document/article. |
<applet> | applet tag is used to define an embedded Java applet.Not supported in HTML5 |
<area> | Defines an area inside an image map |
<article> | article tag is used to define an articleintroduced in html5 |
<aside> | aside tag is used to define the sidebar area introduced in html5 |
<audio> | audio tag used to define sound content in HTML documents.introduced in html5 |
B | |
<b> | b tag is used to make bold text. |
<base> | base tag Specifies the base URL for all relative URLs. |
<basefont> | basefont tag is used to specify a default font, size, and color for all text. Not supported in HTML5 |
<bdi> | bdi tag is used to separate a portion of text that may be formatted in a different direction from other text outside it introduced in html5 |
<bdo> | bdo tag is used to override the current text direction. |
<big> | big tag is used to make the font size one level larger Not supported in HTML5 |
<blockquote> | blockquote tag is used to define a section that is quoted from another source. |
<body> | body tag is used to define the body part of the HTML document. |
<br/> | br tag is used for a single-line break. |
<button> | button tag is used to make a clickable button |
C | |
<canvas> | canvas tag is used to draw a graphics space within a web document. introduced in html5 |
<caption> | caption tag is used to define the caption of the table. |
<center> | center is used to center-align the text. Not supported in HTML5 |
<cite> | cite tag defines the work’s title, website, etc. |
<code> | code tag is used to display a part of the Computer code. |
<col> | defines a column within a table representing common properties of columns |
<colgroup> | colgroup tag is used to define the group of columns in the table. introduced in html5 |
D | |
<data> | data tag is used to add the machine-readable translation. introduced in html5 |
<datalist> | datalish tag is used to provide a list of pre-defined options for input controls introduced in html5 |
<dd> | dd tag is used to provide a description |
<del> | del tag is use to define the text that has been deleted from the document |
<details> | details tag is used to define additional details. introduced in html5 |
<dfn> | dfn tag is used to display a term that is defined within a sentence |
<dialog> | dialog tag is used to create a dialog box/window introduced in html5 |
<dir> | dir tag is used to create a directory list in html docmrnt Not supported in HTML5) |
<div> | div tag is used to create a division or section within an HTML document. |
<dl> | dl tag is sued to define a description list. |
<dt> | dt tag is used to define a term/name in a description list |
E | |
<em> | em tag is Used to emphasize a word or group of words within a text |
<embed> | It creates a container for an external resource, such as a web page, image, media player, or plug-in and application. introduced in html5 |
F | |
<fieldset> | fieldeset tag is used to group similar elements of the form. |
<figcaption> | figcaption tag is used to define a caption for an <figure> element introduced in html5 |
<figure> | figure tag is used to define the self-contained content introduced in html5 |
<font> | font tag is used to define the font, size, and color of a text Not supported in HTML5 |
<footer> | footer tag is used to create a footer section of a webpage. introduced in html5 |
<form> | form tag is used to define an HTML form for user input. |
<frame> | frame tag is used to Define a window (a frame) in a frameset Not supported in HTML5 |
<frameset> | It defines a set of Frames. Not supported in HTML5 |
H | |
<h1> to <h6> | These tags are used to define headings in HTML documents from level 1 to level 6. |
<head> | The metadata/information is set inside head tag |
<header> | header tag is used to make the header of the webpage |
<hr/> | hr tag is used to divide a text/element horizontally into two parts. |
<html> | html tag is the main tag of the HTML document |
I | |
<i> | i tag is used to make italic text. |
<iframe> | iframe tag is use to define an inline frame for other content. |
<img> | img tag is used to include an image within an HTML document. |
<input> | input tag is used to define an input field within an HTML form. in which input can be taken from the user |
<ins> | ins tag is used to Define text that is inserted into an HTML document in place of other text. |
<isindex> | isindex tag is used to display search strings for the current documents. Not supported in HTML5 |
K | |
<kbd> | kbd tag is used to define keyboard input buttons. |
L | |
<label> | lable tag is used to define a label/text for the input element |
<legend> | legend tag is use to define a caption for the content of <fieldset> |
<li> | li tag is used to define a list item |
<link> | links tag is used to links a relationship between the current document and an external resource(most used to link to style sheets). |
M | |
<main> | main tag is used to define the main content of an HTML document. introduced in html5 |
<map> | map tag is use to define an image map with active areas. |
<mark> | imark yag is used to define a marked/highlighted text introduced in html5 |
<marquee> | marquee tag is used to display moving text or images horizontally or vertically. (Not supported in HTML5) |
<menu> | menu tag is used for creating a menu bar area. |
<meta> | meta tag is used to define metadata about an HTML document |
<meter> | meter tag is is used to define a scalar measurement within a known range. introduced in html5 |
N | |
<nav> | nav tag is used for creating a Navigation Bar a section/area. introduced in html5 |
<noframes> | noframes tag is used to define alternative content for users that do not support frame elements. (Not supported in HTML5) |
<noscript> | noscript tag provides alternative content if the script type is not supported in the browser. |
O | |
<object> | object tag is used as the container for an external application in an HTML file. |
<ol> | ol tag is used to define an ordered list. |
<optgroup> | optgroup tag is used to create a group of related options in a drop-down list |
<option> | option tag is used to add an option in a drop-down list. |
<output> | The output tag is used as a container to Define the result of a calculation. introduced in html5 |
P | |
<p> | The p tag is used to define a paragraph. |
<param> | param tag is used to define a parameter for an object element. |
<picture> | picture tag is used to Define a container for multiple image resources introduced in html5 |
<pre> | pre tag is used to make preformatted text. |
<progress> | progress tag is used to define the progress of a task introduced in html5 |
Q | |
<q> | q tag is used to Define a short quotation in HTML |
R | |
<rp> | rp tag is used to define alternative content when the browser does not support ruby annotations introduced in html5 |
<rt> | rt tag is used to define explanations and pronunciations in ruby annotations. |
<ruby> | ruby tag is used to represent ruby annotations. |
S | |
<s> | s tag is used to Define text that is no longer correct |
<samp> | samp tag is used to represent the sample output of a computer program in a document. |
<script> | script tag is used to declare the client-side JavaScript within an HTML document. |
<section> | the section tag is used to define a section in a document. introduced in html5 |
<select> | select tag represents a control that provides a drop-down list |
<small> | small tag is used to define text that is smaller than the original font size of the document. |
<source> | source tag is used to define multiple media resources for media elements (<video> and <audio>) introduced in html5 |
<span> | span tag is used for styling and grouping a part of a text. |
<strike> | strike tag is used to define strikethrough text. (Not supported in HTML5) |
<strong> | strong tag is used to define important text. |
<style> | It is used to contain style information for an HTML document. |
<sub> | sub tag is used to define a text which displays as a subscript text. |
<summary> | summary tag is used to define a summary for an <details> element. introduced in html5 |
<sup> | sup tag is used to define a text which displays as a superscript text. |
<svg> | The SVG tag is used as the container of SVG (Scalable Vector Graphics). |
T | |
<table> | table tag is used to present a table within an HTML document. |
<tbody> | tbody tag is used to define a body for the table |
<td> | td tag is used to define cells for the table |
<template> | template tag is used to define a container for content that should be hidden when the page loads |
<textarea> | textarea tag is used to define multiple line inputs. |
<tfoot> | The tfoot tag is used to define the footer content for the table |
<th> | th tag is used to define the head cell for the table. |
<thead> | thead tag is used to define the header for the table. |
<time> | time tag is used to specify data/time. introduced in html5 |
<title> | the title tag is used to define the title of an HTML document. |
<tr> | The tr tag is used to define the ow cells for the table. |
<track> | traks defines text tracks for media elements <audio> and <video> elements. |
<tt> | tt tag is used to define teletype text. (Not supported in HTML5) |
U | |
<u> | u tag is used to define an underline text. |
<ul> | ul tag is used to define an unordered list |
V | |
<var> | var tag is used to define a variable in HTML |
<video> | video tag is used to embed video content. introduced in html5 |
W | |
<wbr> | wbr tag is used to define a possible line break within the text introduced in html5 |
HTML tags list with examples | Basic HTML tags | HTML tags pdf |