HTML tags can be considered hidden keywords or commands
incorporated in HTML, which can define how your browser will
display the content and format of the web page. Most tags of HTML
have two sections: an opening and a closing portion, and any text
is written within that has its effect based on the working of the
tag. The most common example is the
<html> tag, which has both
a starting tag and ending tag.
- All HTML documents begin with
<! DOCTYPE html>.
- The HTML document begins with
<html>and ends with
- HTML code that is written inside the
</head>tags of an HTML document are not visible in the web browser.
- Only the content inside the
</body>tags are displayed in the browser.
HTML tag which is usually written as
</HTML> is the only tag that is a must for
writing HTML pages. HTML tag has both an opening
<html> and a closing tag
</html>. The closing of tags is done by a
forward slash (/) at the very start of the tag name.
Tags with opening and closing tags are called container tags, and tags with only one opening tag and no closing tag are called empty tags.
<head> tag is
another important tag used to add the header in HTML. It is used to
give various additional information about the web page along with
description and title to your page, which gets displayed in the
title bar or acts as an indicator of what information to use or on
which page you are currently in. The
<title> Tag is written within
Here is a simple example of all the above three tags:
<!DOCTYPE html> <html> <head> <title>This is page title.</title> </head> </html>
<body> tag is used to give the body,
i.e., the visible section of the HTML document. All formatting and
writing of content are done in this section within the opening
<body> and the closing
</body> tag. If your HTML code does not have a
body tag associated with it, the HTML code will still run as
written in the above example (only show the title in the title
bar). This tag contains the information and formatting that will be
seen in the main web browser on a web page.
It is to be noted that, together, these three necessary tags,
<body>, make up the skeleton of an XHTML
document, and these are the only foundation tags upon which all web
pages are created or developed.
<!DOCTYPE html> <html> <head> <title>This is page title.</title> </head> <body> <h2>This is page heading.</h2> <p>This is my first <strong>paragraph text</strong>.</p> </body> </html>