HTML documents are text files made up of HTML elements. HTML elements are defined using HTML tags.
HTML Tags :-
HTML tags are used to mark-up HTML elements.
HTML tags are surrounded by the two characters < and > called angle brackets.
The first tag in a pair is the start tag, the second tag is the end tag.
HTML tags normally used in pairs like <body> and </body>.
The text between the start and end tags is the element content.
HTML tags are not case sensitive, <body> means the same as <BODY>.
HTML Elements :-
<html>
<head>
<title>This is title of my html page</title>
</head>
<body>This is my first HTML page.
<b>This is bold text</b>
</body>
</html>
This is an HTML element :-
<b>This is bold text</b>
The HTML element starts with a start tag i.e <b> and ends with an end tag i.e </b> here.
The content of the HTML element is "This is bold text".
The purpose of the <b> tag is to define an HTML element that should be displayed as bold.
This is also an HTML element :-
<body>
My first HTML page.
<b>This is bold text</b>
</body>
This HTML element starts with the start tag <body>, and ends with the end tag </body>. The purpose of the <body> tag is to define the HTML element that contains the body of the HTML document.
HTML Tag Attributes :-
Tags can have attributes. Attributes can provide additional information about the HTML elements.
This <body> tag defines the body element of your HTML page. With an added bgcolor attribute, you can tell the browser that the background color of your page should be yellow like this: <body bgcolor="yellow">.
This <table> tag defines an HTML table. With an added border attribute, you can tell the browser that the table should have no borders: <table border="1">
Attributes always come in name/value pairs like name="value". Attributes are always added to the start tag of an HTML element.
In some situations, like when the attribute value itself contains quotes, it is necessary to use single quotes like this example:-
name='Upendra "Singh" Pundhir'