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.



HTML Documents

  • All HTML documents begin with <! DOCTYPE html>.
  • The HTML document begins with <html> and ends with </html>.
  • HTML code that is written inside the <head> and </head> tags of an HTML document are not visible in the web browser.
  • Only the content inside the <body> and </body> tags are displayed in the browser.

HTML Tag

HTML tag which is usually written as <html>…. </html> or <HTML>…. </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

The <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 this <head> tag.

Here's a simple example of html, head, and title tags:

Example:

<!DOCTYPE html>
<html>

    <head>
        <title>Page Title</title>
    </head>

</html>

BODY Tag

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, <html>, <head>, and <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.

Example:

<!DOCTYPE html>
<html>

    <head>
        <title>Page Title</title>
    </head>

    <body>
        <h2>This is page heading.</h2>
        <p>This is my first <strong>paragraph text</strong>.</p>
    </body>

</html>


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram